It's not a secret anymore!*
The moose likes JDBC and the fly likes Resultset Exhausted Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Resultset Exhausted Exception" Watch "Resultset Exhausted Exception" New topic
Author

Resultset Exhausted Exception

Grishma Dube
Ranch Hand

Joined: Jul 01, 2003
Posts: 275
Hi All,
I am getting following exception :-
java.sql.SQLException: Exhausted Resultset
while retrieving values from resultset. I am trying to retrieve values for multiple users but getting this exception only for one user and for others it is working fine.

Can anyone help me???
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30795
    
157

Grishma,
It looks like you are never getting a match to set the boolean to false and end the loop. When hResultSetQL.next() gets called after it has run out of data, you get the error.
It is good to use a while(hResultSetQL.next()) loop. That removes any possibility of running out of result set. Also, note that resultsets are never null after returning from the database. They can be empty, but not null.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: Resultset Exhausted Exception