Does Java Connection.close rollback into a finally block?.
I know .Net SqlConnection.close does it.
With this I could make try/finally blocks without catch…
Example:
try { conn.setAutoCommit(false); ResultSet rs = executeQuery(conn, ...); .... executeNonQuery(conn, ...); .... conn.commit(); } finally { conn.close(); }
According to the javadoc, you should try to either commit or roll back before calling the close method. The results otherwise are implementation-defined.