• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can you execute a query while processing results

 
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: 35279
384
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic