This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SQl.SQLException - Exhausted Resultset .. please help  RSS feed

 
howie jao
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Below is my code.
RETRIEVE_CONTENTID_FROM_CSTSITE_ENTITY = select a,b,c,d,e,f,g,h from xx_table where id = ?

I received error on the 2nd GetLong() ...line 22

Please help and thanks in advanced.

Howie

 
howie jao
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please remove the post. I have found the error thanks.
 
Rob Spoor
Sheriff
Posts: 21116
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't just remove threads because they are solved. Others may learn from our mistakes. Which is why I would like you to share your solution with us, please.

Also, you have some code duplication there, with adding the longs. Perhaps you'd like to make methods out of those:
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he missed {} on the while statement
 
Rob Spoor
Sheriff
Posts: 21116
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed so, I missed that. As a result, only the rs.getLong("a") statement is inside the loop. All others are executed after the loop has ended and you've already gone through all records.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!