Here you can find the source of safeCommit(Connection conn)
public static void safeCommit(Connection conn) throws SQLException
//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(); } } } }