Java examples for java.sql:Transaction
rollback Connection transaction
//package com.java2s; import java.sql.Connection; import java.sql.SQLException; public class Main { public static boolean rollback(Connection conn, boolean oldCommitStatus) { if (conn == null) { return true; }//from ww w . j av a 2s . c o m try { conn.rollback(); // ???? conn.setAutoCommit(oldCommitStatus); return true; } catch (SQLException e1) { e1.printStackTrace(); return false; } } public static Boolean setAutoCommit(Connection conn, boolean commitStatus) { if (conn == null) { return true; } try { boolean commit = conn.getAutoCommit(); conn.setAutoCommit(commitStatus); return commit; } catch (SQLException e1) { e1.printStackTrace(); return true; } } }