Hi
Our application uses a custom data source to manage the connections to the customer's Oracle database.
We need to use proprietary OracleConnection methos, so we cast the generic Connection JDBC to OracleConnection. Example:
@Stateless public class TestEJB implements TestEJBLocal { @Override public void testDriver() throws Exception { // The data source is obtained from the JNDI DataSource ds = (DataSource)new InitialContext().lookup("jdbc/ORACLE_TEST"); // When casting the Connection a ClassCastException is thrown, and the code fails here OracleConnection oc = (OracleConnection) ds.getConnection(); } }
At line 12 of the above code, we get the following exception:
Caused by: java.lang.ClassCastException: Cannot cast class com.sap.engine.services.dbpool.cci.ConnectionHandle to interface oracle.jdbc.OracleConnection
We do understand why we are getting the class cast exception (it is explained in this connection management article).
What we don't know is how we can overcome this problem. We need to use an "oracle.jdbc.OracleConnection" object to access proprietary methods (we are dealing with Arrays and other objects).
Can you please suggest options to overcome this? Is some sort of configuration available at the datasource level?
thanks in advance.