This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Multiple Result Sets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Multiple Result Sets" Watch "Multiple Result Sets" New topic

Multiple Result Sets

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
I have an app that is returning 5 result sets. When I run this stored procedure outside of my java app, it seems to work okay. However when I execute query it is doing something strange. The first result set will always only return one row. However the others could have multiple rows. The first time I did a cs.executeQuery().... worked fine. To read the next result set I did

For some reason it is reading the result set as if it has 2 rows.... when it actually only has one row when I run it outside of the java app. Any ideas? I'm sure it's something stupid I've done, but I just can't seem to put my finger on it.
Thanks for any help you can give me!
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
The callable statement will return the array. Just iterate it and collect the result sets.
I agree. Here's the link:
subject: Multiple Result Sets
Similar Threads
Result Set
Retriving data from table
Memory leak with MySQL JDBC driver
How ResultSet works? PreparedStatment handicaps?
How to check if resultset has only one row or more?