i am using orcale, mysql databases , if i use context.xml i can get datasource for only one db
Joined: Feb 26, 2009
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).
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...
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.