Friday, March 30, 2001 02:43 PM
Okay, you are starting a transaction before the loop and you are comitting the transaction within the body of the loop. Fine. This code should work for atleast one time. When the body of the loop is executed second time, you again try to commit the transaction. But which transaction? The trasaction that you have started before the loop is not open anymore. It's commited in first go of the loop. So what you can do is to open a fresh transaction every time the body of the loop is executed. Something similar to the code follows
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT * FROM Test");
//start transaction here
// do something
Hope this will help.