This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can you execute a query while processing results  RSS feed

 
Robert Johnson
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you execute a query in the while loop of a different resultSet?
e.g.,...



it only works once, it stops at the end of the while loop, i.e., it doesnt loop around the resultSet like it should.

[edited to add code tags and change "u" to "you"]
[ March 24, 2005: Message edited by: Jeanne Boyarsky ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36634
475
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Robert,
Executing the update on stmt indirectly closes the select query also using the stmt object. If you use a different Statement object, the problem will go away.

Also, you should consider using a PreparedStatement here. Especially since the update is occuring in a loop.
 
Robert Johnson
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thanks i'll try that.

i would have thought it wouldnt need the statment object as i thought it just used it once and then loop around the resultSet only.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!