My Oracle Support Banner

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

Last updated on MARCH 08, 2017

Applies to:

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


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


Connection c = getConnection();
CallableStatement cs = c.prepareCall("{ call testpack.fo_list ( ?, ?) }");

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

The example is based on the code sample from <>


To view full details, 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 a vibrant support community of peers and Oracle experts.