aspose file tools
The moose likes JDBC and the fly likes Getting classcast exception when getting cursor from stored prcedure Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Getting classcast exception when getting cursor from stored prcedure" Watch "Getting classcast exception when getting cursor from stored prcedure" New topic
Author

Getting classcast exception when getting cursor from stored prcedure

Reddy Sudhakar
Greenhorn

Joined: Sep 23, 2002
Posts: 11
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

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32708
    
    4
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.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

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

Joined: Sep 23, 2002
Posts: 11
But same code in working in server, But in my local environment its not working
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Getting classcast exception when getting cursor from stored prcedure
 
Similar Threads
Stored Procedure Problem
java.sql.SQLException: Unsupported feature
Deployment Problem
Problem in calling PL/SQL from JAVA program
java and jdbc