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: 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

To view full details, sign in with your My Oracle Support account.

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


In this Document
  Symptoms
  Cause
  Solution
  References

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.