Invalid Handle Exception!

Background: I have a SQL database created and maintained via MS Access 2003. I use JDBC to connect and interact with this database. So far my program has been able to do everything from querying a table to inserting new rows to deleting others, but has had no luck with updating rows either through the execute()/executeUpdate() methods or the ResulSet updateInt()/UpdateString() methods.

So currently I'm recieving an Invalid Handle error during runtime for this program. I ran a stack trace and the line that gave the error was where I was creating a ResultSet from an executeQuery(). I'm unsure what Invalid Handle means, and am further baffled at this error since I have another method with the EXACT SAME line for the query and it receives no errors. To put it into better veiw I have my main class/main method, and from there I call a few different methods from this other class I have. I call this one method, works fine; I call this other method a little while afterwards and it has the exact same few lines at the beginning as the previously mentioned method. Suddenly I get this Invalid Handle error. Like I said, the error said it's happening when I'm doing ResultSet rs = stmnt.executeQuery("SELECT columns FROM table WHERE column LIKE 'string'");

Please help! Thank you!

[1308 byte] By [Kolo_Rahla] at [2007-10-1 22:41:11]
# 1

i cant ever open adobe or other pdf files im not new to computers but i am far from profficient. when i ask adobe and others about invalid handles, broken ? whatever and dont have permission etc. all i get is silence or blank looks....i think adobe suks very hard and all the rest of this stuff is just terrible and i want to change to linux....i sure wish i knew more but when i ask a lot of people who claim to be knowledgable i find that all they can do is type well and open and parse documents where i know much more about most hardware and software......anyone out there able to help a dyslexic non typer?

cyrilwilliamsa at 2007-7-13 14:43:41 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

I was facing the same problem.

This happens when the statement you are executing the query from is closed.

In your case

ResultSet rs = stmnt.executeQuery("SELECT columns FROM table WHERE column LIKE 'string'");

stmnt might be closed before this line.................

if it is closed remove that line or

type

stmnt = conn.createStatement();

where conn is your connection to database.

AshishArya_2001a at 2007-7-13 14:43:41 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...