I have numerous statement objects and result sets that are defined in different methods in one class. I am closing each statement object in a finally block at the end of each method. Now I keep getting "Statement is closed" error when I try to run my app. What is going on? If I am creating a new Statement object whenever that method is run, why is it telling me that it is closed? It doesn't get closed until it's done running through the method, right? Here's some code...
Is con a java.sql.Connection object? If so, is that just a typo in your post, do you mean con.createStatement();??? If con is not a java.sql.Connection object, then I think I need to see the getStatement() method code. Other than the con.getStatement(), I don't see anything wrong.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Joined: Feb 28, 2001
Sorry! I have an SQLConnection class that is creating the statement. Here it is:
Does that help? Thanks again!
Joined: Sep 13, 2002
Argh.... for some reason I can't see your initial post now. Can you repost the original offending method that was causing the exception and specifically which line? I don't see anything wrong with your SQLConnection class.