conn.setHoldability( ResultSet.CLOSE_CURSORS_AT_COMMIT );
conn.setAutoCommit( true );
PreparedStatement ps;
ResultSet rs;
Wrapper41Statement wrapper;
ps = conn.prepareStatement( "values ( 1 )" );
println( "Testing implicit closure WITH autocommit on a " + ps.getClass().getName() );
wrapper = new Wrapper41Statement( ps );
wrapper.closeOnCompletion();
rs = ps.executeQuery();
rs.next();
rs.next();
assertTrue( rs.isClosed() );
assertTrue( ps.isClosed() );
conn.setAutoCommit( false );
// now retry the experiment with an explicit commit
ps = conn.prepareStatement( "values ( 1 )" );
println( "Testing implicit closure WITHOUT autocommit on a " + ps.getClass().getName() );
wrapper = new Wrapper41Statement( ps );
wrapper.closeOnCompletion();
rs = ps.executeQuery();
rs.next();
rs.next();