AIR TRAVELS AIR TRAVELS - 2 years ago 146
Java Question

ResultSet not open. Operation 'getString' not permitted. Verify that autocommit is off.?

I am using apache derby and getting the above error here is my code, actually I'm just not getting all the children under the parents, it only give me one level of children, so kindly tell me how to make tree parent and child but this gives only one level of child with above error

getting connection

public static Connection getConnection(){

Connection connection = null;

try {
//Get a connection
connection = DriverManager.getConnection(dbURL);
} catch (Exception except) {
return connection;

and error in second loop at last reading rs1

Statement stmt;

stmt = MainUI.getConnection().createStatement();

Answer Source

Nesting the result sets is your problem, I believe.

To have two different result sets open, you must have two separate Statement instances, so each can have its own ResultSet. Otherwise, running the second query on the same Statement instance will close the first ResultSet.

See this answer for more information:

Also, have a look at the Javadocs for the java.sql.Statement class:

By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download