This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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 ]
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'?
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.