This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.