Reputation: 7551
I am setting up a legacy Web application and having a few questions. Currently the web application packed ojdbc jar under WEB-INF/lib
and Tomcat context.xml
has a resource tag referring to JNDI datasoure. It's Oracle database so the connection string is through oci
(I am using Windows system)
<Resource name="jdbc/MainSource"
auth="Container" type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:oci:@username/password@tnsinstance"
validationQuery="SELECT sysdate from DUAL;"
jdbcInterceptors="ConectionState" />
From what I can see, the Tomcat server don't have any ojdbc.jar
under $CATALINA_HOME/lib
directory. Then here are my questions
WEB-INF/lib
?driverClassName
)?Updated: A little further details to question2 - there is Oracle client installed on the server and within the installation there is ojdbc jar file, which should be in $PATH
after ORACLE_HOME
being registered. However I still don't think Tomcat server will reach out to OS $PATH
to get ojdbc jar even if it is an Oracle OCI connection, according to Tomcat JNDI doc
Upvotes: -1
Views: 52
Reputation: 301
Fallback to application-scoped resources occurs when an application avoids using the container-managed JNDI datasource and instead relies on resources bundled and loaded within the application itself. This can happen due to explicit configuration or as a backup mechanism when JNDI resources fail to initialise.
If the ojdbc.jar is missing from $CATALINA_HOME/lib, Tomcat cannot initialise the JNDI datasource, however, the application can still function if it directly loads the driver from WEB-INF/lib. Many legacy web applications were not designed to use container-managed JNDI datasources by default. They often have hardcoded connection logic as a fallback.
Upvotes: 0