1. Log in as user that owns tomcat
2. Shutdown tomcat if running
3. export this env
export JAVA_OPTS="-Doracle.net.tns_admin=/u01/oracle/product/10.2.0/network/admin"
5. Make sure tomcat owner is able to read file sin the above TNS directory
4. Startup tomcat
5. DB connection using tns should work
Note:
- Above worked for me on 10.2.0.1.0 database with, tomcat-5.5.20 (Linux) and jdk1.6.0_12 (May 2013)
- Above worked for me on 11g database with, tomcat-7.0.40 (Win) and 1.7.0_21 (May 2013)
- Similar to normal thin connection ("jdbc:oracle:thin:@nidevdb", username, password)
- Some docs / sites also say you can use below, instead (i could not get it to work).
System.setProperty("oracle.net.tns_admin", "/u01/oracle/product/10.2.0/network/admin");
more info, see book:
Book: Oracle® Database JDBC Developer's Guide (11g Release 2 (11.2))
Chapter: 8 Data Sources and URLs
No comments:
Post a Comment