File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Class Cast exception in oracle.sql.ArrayDescriptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Class Cast exception in oracle.sql.ArrayDescriptor" Watch "Class Cast exception in oracle.sql.ArrayDescriptor" New topic

Class Cast exception in oracle.sql.ArrayDescriptor

Raka Sheth

Joined: Aug 08, 2006
Posts: 1
Hi All
We are using Oracle Types to pass the list of data to store procedure.We are getting class cast exception while using the connection pool of websphere .FOllowing is the code
cs = connection.prepareCall("{call temp_list(?)}");
System.out.println("Prepare statement is formed");
oracle.sql.ArrayDescriptor descrip =
oracle.sql.ARRAY a = new oracle.sql.ARRAY(descrip, connection, s);

We are getting class cats exception at following line
oracle.sql.ArrayDescriptor descrip =

Please help me in resolving this issue
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

The connection you are obtaining here:

Cannot be used here:

You need an "OracleConnection".

I don't use WebSphere, so I don't know if it is possible to obtain an "OracleConnection".

Good Luck,
Arvind Sampath
Ranch Hand

Joined: May 11, 2005
Posts: 144
As Avi said, the createDescriptor() method requires that your connection be an 'OracleConnection'. Internally, the createDescriptor() method *casts* your connection object to 'OracleConnection'. We faced the same problem in Weblogic 5.1. Due to time & other constraints we had no other option but to use a *direct* connection, using thin driver, instead of a Connection Pool. Try using the direct connection until you find a permanent solution.

oracle.sql.ARRAY a = new oracle.sql.ARRAY(descrip, connection, s);

I guess this is not the correct way of passing arrays. You may have to use the cs.setARRAY(1,a) method. This method is part of the OracleCallableStatement class. So you have to cast your CallableStatement to OracleCallableStatement like this

Pls let us know your progress in this.

I agree. Here's the link:
subject: Class Cast exception in oracle.sql.ArrayDescriptor
It's not a secret anymore!