This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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: 9291
    
  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: 41059
    
  43
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 - my free Android networking tools app
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db
 
Similar Threads
Jboss and mysql connection (failover)
i am using orcale, mysql databases , if i use context.xml i can get datasource only for one db
Context Question
How to use configured datasource
Legacy Data Store