• 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

Getting classcast exception when getting cursor from stored prcedure

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am gettting java.lang.ClassCastException: $Proxy63. WHen i am getting cursor from the stored procedure. In jboss 4.0.4

I am using java.sql.CallableStatement.

Here is my code
cstmt.setObject(i++, ratingTypeId, OracleTypes.NUMBER);
cstmt.setString(i++, ACTIVE_FLAG);
cstmt.registerOutParameter(i++, OracleTypes.CURSOR);
cstmt.registerOutParameter(i++, OracleTypes.NUMBER);
cstmt.execute();
rs = (ResultSet)cstmt.getObject(3); // Here i am getting classcast exception
Thanks in advance.

Regards
Sudhakar

 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the value of i?
Try printing out the Object returned from no 3; that is obviously not a ResultSet or similar.

I don't know a lot more, I am afraid.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The normal way to get a ResultSet from a query like that is to use CallableStatement.getResultSet(), which returns... a ResultSet! That may or may not work in this particular case, but it's more likely to work than your code is.
 
Reddy Sudhakar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But same code in working in server, But in my local environment its not working
reply
    Bookmark Topic Watch Topic
  • New Topic