Avoiding ClassCastException when using getCursor from Wrapped Objects (Doc ID 1324743.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version: 10.1.0.2 and later   [Release: 10.1 and later ]
Information in this document applies to any platform.

Symptoms


JDBC application gets a ClassCastException when invoking a Callable Statement.
This can happen when the connection is retrieved from a Weblogic data source or other application server data sources that wrap the Oracle JDBC objects . This is not an issue with real Oracle JDBC objects such as when the connection is built using java.sql.DriverManager

example:

Connection c = getConnection();
CallableStatement cs = c.prepareCall("{ call testpack.fo_list ( ?, ?) }");
cs.registerOutParameter(1,OracleTypes.CURSOR);
cs.registerOutParameter(2,Types.INTEGER);
cs.execute();

ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);


The example is based on the code sample from <>

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms