Java JDBC Collection Transaction rollback(Connection connection)

Here you can find the source of rollback(Connection connection)

Description

Roll back the transaction of the given connection.

License

Open Source License

Parameter

Parameter Description
connection the connection that used to roll back the transcation. If it is null, nothing would happen

Declaration

public static void rollback(Connection connection) 

Method Source Code


//package com.java2s;
import java.sql.Connection;

import java.sql.SQLException;

public class Main {
    /**//from  w  w  w  .java 2s . c om
     * <p>
     * Roll back the transaction of the given connection.
     * </p>
     *
     * @param connection the connection that used to roll back the transcation. If it is null,
     * nothing would happen
     */
    public static void rollback(Connection connection) {
        if (connection != null) {
            try {
                connection.rollback();
            } catch (SQLException e) {
                // ignore the exception here.
            }
        }
    }
}

Related

  1. releaseAutoCommit(Connection conn, boolean changedAutoCommit)
  2. resetTxnState(Connection pCon, boolean forceIgnoreUnresolvedTransactions, boolean autoCommitOnClose, boolean txnKnownResolved)
  3. rollback(Connection conn)
  4. rollback(Connection conn)
  5. rollback(Connection conn)
  6. rollback(Connection connection)
  7. rollback(Connection connection)
  8. rollback(Connection connection)
  9. rollback(Connection sqlConn)