aspose file tools*
The moose likes JDBC and the fly likes Size of ResultSet... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Size of ResultSet..." Watch "Size of ResultSet..." New topic
Author

Size of ResultSet...

Chris Cairns
Ranch Hand

Joined: Jan 31, 2003
Posts: 48
I'm trying to create a utility method that will print out the records of any ResultSet. I'm trying to get the size of the ResultSet and to then print out the records in a for loop. I keep getting a SQL Exhaustion error in my current code, which I pasted below. Could someone please point me in the right direction.

[ April 25, 2003: Message edited by: Chris Cairns ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5



This does not avoid any SQL exhaustion errors (what is that anyway?) because you're just creating another reference to the one and the same ResultSet object. What are you trying to achieve with this?




After executing this piece of code up to (X), you have ran through the ResultSet object referred by 'resultSet'. Right after (X) you are reading the value of the first column of the same ResultSet object you just iterated though. I doubt this is what you meant? How does that first column's value relate to 'recordSize'?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1132

Hi Chris,
According to the code you have posted, when your "while" loop terminates,

you have reached the end of your "ResultSet".
Therefore, this line of your code,

causes the "SQL Exhaustion" error you claim to be getting.
I will not even try to guess why you wrote the code this way, and therefore there isn't much more I can offer you (like suggesting a way to avoid getting the "SQL Exhaustion" error).
Hope this has helped you.
Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Size of ResultSet...