This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db" Watch "i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db" New topic
Author

i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db

rk palleru
Greenhorn

Joined: Feb 26, 2009
Posts: 22
please help me

i am using orcale, mysql databases for two different web applications , i am executing both applications simultaneously if i specify in context.xml ,i can get datasource object only for one db(either oracle or mysql).
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Can you tell why don't you want to do a lookup. When you declare a datasource using context.xml in apache tomcat, then it is added as a JNDI resource. I don't think you can retrieve it using anything other than lookup...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
The whole point of DataSource is to be used through JNDI. If you're set on not using JNDI (why?) you might just as well use DriverManager.


Ping & DNS - updated with new look and Ping home screen widget
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


how to get datasource object in tomcat without using jndi for oracle/mysql


Well for Oracle, you can use Class oracle.jdbc.pool.OracleDataSource and OracleXADataSource can be used.
1) create object of OracleDatasource
2) set the connection parameters (DB details) and get connection.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db
 
Similar Threads
Context Question
i am using orcale, mysql databases , if i use context.xml i can get datasource only for one db
How to use configured datasource
Legacy Data Store
Jboss and mysql connection (failover)