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 Accessing multiple resultsets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Accessing multiple resultsets " Watch "Accessing multiple resultsets " New topic

Accessing multiple resultsets

Prasanna Kulkarni

Joined: Jan 07, 2004
Posts: 15
Hi All;

Here's some wierd problem I'm facing while handeling multiple resultsets from stored procedure.

I've a stored procedure that returns multiple cursors. And I access them
in my code. After accessing the first resultset when I want to access next
one. As usual I code it like


But I get ResultsetObj as null...and I know that stored produre returns valid data for 2nd I have confirmed it by running the procedure in stored procedure builder.
I'm using IBM DB2 7.0

I'll be very glad, If anybody can give me the clarification.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
A couple of questions and suggestions:

What happens if you swap the cursors round in your SP? Does the first ResultSet then contain the right results?

I've experienced problems in the past with Sybase drivers whereby if you make any changes to the statement's parameters after having executed it (or even access output parameters, I think) then the statement loses (or resets) its ResultSet. Could that be your problem?

Is there a logical difference between an empty ResultSet and a null one, i.e. if your query returns zero rows, is ResultSet null or just created empty? Obviously I realise there's a physical (Java) difference.

I agree. Here's the link:
subject: Accessing multiple resultsets
jQuery in Action, 3rd edition