• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class Cast exception in oracle.sql.ArrayDescriptor

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
connection=myDatasource.getConnection();
cs = connection.prepareCall("{call temp_list(?)}");
System.out.println("Prepare statement is formed");
oracle.sql.ArrayDescriptor descrip =
oracle.sql.ArrayDescriptor.createDescriptor("MY_LIST",connection);
oracle.sql.ARRAY a = new oracle.sql.ARRAY(descrip, connection, s);
cs.setArray(1,a);
cs.execute();

We are getting class cats exception at following line
oracle.sql.ArrayDescriptor descrip =
oracle.sql.ArrayDescriptor.createDescriptor("MY_LIST",connection);


Please help me in resolving this issue
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Raka,
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,
Avi.
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
cs.setArray(1,a);



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.


Arvind
reply
    Bookmark Topic Watch Topic
  • New Topic