Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error: ResultSet not open. Operation 'getInt' not permitted. Verify that autocommit is off.

 
Rosie Fairfield
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an app in NetBeans that displays and manages a database.

It was working great. However, I am now getting the following errors:



My app shows the first record but gives me an error dialog when I try the Next button.

I tried



it didn't help.

Then I tried checking the autocommit value before the SQL calls that cause the errors:



and this is what I'm getting:



On the face of it autocommit is off so what could be causing the issue?
 
Paul Clapham
Sheriff
Posts: 21567
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would track down the person who wrote that error message and step on their toes firmly. Because the message leads to the belief that enabling autocommit has something to do with the fact that the ResultSet was closed in the wrong place. (Which seems extremely unlikely to me.) And then I would ignore that part of the message and examine the code to find out why the ResultSet is being closed before the getInt() method is called in that particular case.
 
Rosie Fairfield
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for replying.

I figured out the problem:

I was calling


instead of


where stmt is a Statement variable I use for all my querys.

Apparently, that's a bad idea lol
 
Dave Tolls
Ranch Hand
Posts: 2099
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know why that works.
Because I for one don't, based on that error message...though the message itself is a little confused.
 
Rosie Fairfield
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Actually, the real problem was that I was using the same Statement variable for all my querys so I lost the results of one query each time I did another query
No wonder it couldn't find the records from the first query!!

I feel really stupid but at least my app is working just fine now
 
Dave Tolls
Ranch Hand
Posts: 2099
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes much more sense...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic