How does tomcat know where to find tnsnames.ora
Pergunta
I have an oracle database on a server that tomcat is connecting to.
So I have configured in server.xml :
<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" maxWait="-1" name="jdbc/test" password="test" type="javax.sql.DataSource" url="jdbc:oracle:thin:@test:1111:testdb" username="test"/>
tnsnames.ora is locally located on my computer, but I am wondering how is it being registered by tomcat ? I do not see anyrhing in the tomcat xml config files which points to tnsnames.ora
Solução
The tnsnames.ora file is not consulted at all because you are using the thin driver. If you wanted it to utilize it, you would need to switch to the Oracle OCI driver. You are specifying the host:port:SID already in your connection String. Tomcat does not need the tnsnames file when you do this.
Outras dicas
Check the setenv.sh file in bin directory. You can specify the directory where the file tnsnames.ora is found in the JVM parameters:
-Doracle.net.tns_admin=/tomcat/conf/