Java JDBC Collection Transaction safeCommit(Connection conn)

Here you can find the source of safeCommit(Connection conn)

Description

safe Commit

License

Apache License

Declaration

public static void safeCommit(Connection conn) throws SQLException 

Method Source Code

//package com.java2s;
/*/*from   www  .j a v a  2  s .c  o m*/
 * Copyright (c) Jim Coles (jameskcoles@gmail.com) 2018 through present.
 *
 * Licensed under the following license agreement:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Also see the LICENSE file in the repository root directory.
 */

import java.sql.*;

public class Main {
    public static void safeCommit(Connection conn) throws SQLException {
        if (conn != null) {
            try {
                conn.commit();
            } catch (SQLException ex) {
                conn.rollback();
            }
        }
    }
}

Related

  1. rollbackAndClose(Connection con)
  2. rollbackAndCloseQuietly(Connection conn)
  3. rollbackQuietly(Connection conn)
  4. rollbackQuietly(Connection conn)
  5. rollbackQuietly(Connection connection)
  6. setAutoCommit(Connection conn, boolean autoCommit)
  7. setAutoCommit(final Connection connection, final boolean value)
  8. setAutoCommitEL(Connection conn, boolean b)
  9. setAutoCommitMode(Connection conn, boolean autoCommit)