Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean autoCommitDefault = conn.getAutoCommit();
- try {
- conn.setAutoCommit(false);
- /* You execute statements against conn here transactionally */
- conn.commit();
- } catch (Throwable e) {
- try { conn.rollback(); } catch (Throwable ignore) {}
- throw e;
- } finally {
- try { conn.setAutoCommit(autoCommitDefault); } catch (Throwable ignore) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment