aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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: 9321
    
  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: 42919
    
  68
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.
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