File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes Exahausted ResultSet Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Exahausted ResultSet Error" Watch "Exahausted ResultSet Error" New topic
Author

Exahausted ResultSet Error

rambabu desina
Ranch Hand

Joined: May 26, 2012
Posts: 39

Dear Ranchers,

i have got the following error



and my java code is


it is not multithreaded program.
please tell me reasons for Exahuasted resulset.


thanks and regards
Ram.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19692
    
  10

rambabu desina wrote:please tell me reasons for Exahuasted resulset.


There's only one reason. The cursor was at the end of the ResultSet, and you called the next() method, asking to move the cursor to the non-existent next row.

In your example there, that would mean that the ResultSet was empty.
rambabu desina
Ranch Hand

Joined: May 26, 2012
Posts: 39

Paul Clapham wrote:
rambabu desina wrote:please tell me reasons for Exahuasted resulset.


There's only one reason. The cursor was at the end of the ResultSet, and you called the next() method, asking to move the cursor to the non-existent next row.

In your example there, that would mean that the ResultSet was empty.


thanks for reply.
i executed query at toad it is giving results.
but when i executed using above programe it was giving exhausted resultset error .

Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19692
    
  10

Sorry. Trying to persuade yourself that the error message is lying to you is a very poor debugging strategy. I suggest you try a better strategy, namely to assume that the error message is correct and start working from there. Denial is just not a practical approach.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3717
    
  61

If your query relies on implicit conversion, the problem might be that your Java session locale differ from TOAD session locale, making identical query return different results. This typically happens with dates. See Avoid Implicit Conversions.

I'm just guessing, of course, as you didn't provide enough information. I may well be wrong.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Exahausted ResultSet Error
 
It's not a secret anymore!