I want to get the OracleConnection from a WsJdbcDataSource in an application running in WebSphere Application Server 9, but I'm not able to unwrap the connection.
I'm using Oracle ojdbc8 set up as a JDBC provider, and as here I've found some question answers suggesting to leave any driver library from the application out, I marked in my pom the ojdbc dependency is as 'provide'. I tried as well to check I'm actually dealing with an Oracle DataSource so I checked the following:
System.out.println("Class: " + conn.getMetaData().getClass());
System.out.println("Driver: " + conn.getMetaData().getDriverName());
System.out.println("Name: " + conn.getMetaData().getDatabaseProductName());
System.out.println("isWrapperFor OracleConnection: " + conn.isWrapperFor(OracleConnection.class));
/* Output:
Class: com.ibm.ws.rsadapter.jdbc.WSJdbcDatabaseMetaData
Driver: Oracle JDBC driver
Name: Oracle
isWrapperFor OracleConnection: false
*/
Even though it's an Oracle Connection as I can see, "WsJdbcConnection does not wrap objects of type oracle.jdbc.OracleConnection".