• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLRecoverableException: Closed Statement: next

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am getting the following error message:



at Jobs.doGet(Jobs.java:197) is while(rs.next()){. The following is my code:


Please advise

Thanks in anticipation

Best regards
 
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
Is that happening on the first time through the loop?
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Is that happening on the first time through the loop?


Sometime its throwing this error but sometime its work fine

Best regards
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Farakh khan wrote:Sometime its throwing this error but sometime its work fine


Then that suggests you have more than one thread (i.e. more than one user request) using that code, and that you've got a race condition. I notice that your "rs" variable isn't declared in the code fragment you posted -- is it an instance variable of the servlet?
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your favorable reply.

I updated my first post and added my whole class code. Kindly check and advise what should to do?

Thanks again
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those variables which are instance variables of your servlet should all be local variables of the doGet() method. Otherwise you're liable to encounter race conditions like the one you described.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks from the bottom of my heart
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic