I'm facing a weird behavior with tomcat data source and OracleConnection
Case 1:
I have configured datasource in tomcat 8 for oracle12c and placed the ojdbc8.jar in tomcat_home/lib
folder.
After that I'm executing this below code and it's working
try
{
if (connection.isWrapperFor(OracleConnection.class))
{
oracleConnection = connection.unwrap(OracleConnection.class); //working fine
}
}
catch (SQLException ex)
{
}
Case 2:
configured datasource again and placed the ojdbc8.jar in tomcat_home/lib
folder as well as in WEB-INF/lib
of dynamic web project.
After that I'm executing same above code and it's not unwrapping the connection and i'm getting null in oracleConnection
.
Why is that happening?