Java JDBC Collection Transaction commit(Connection conn)

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

Description

Commit all transactions associated with the specified connection

License

Open Source License

Declaration

public static boolean commit(Connection conn) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.PreparedStatement;

public class Main {
    /**/* w w  w.  j a v  a 2s.  com*/
     * Commit a transaction associated with the specified 
     * statement
     */
    public static boolean commit(PreparedStatement stmt) {
        try {
            return commit(stmt.getConnection());
        } catch (Throwable t) {
        }
        return false;
    }

    /**
     * Commit all transactions associated with the specified 
     * connection
     */
    public static boolean commit(Connection conn) {
        try {
            if (!conn.getAutoCommit()) {
                conn.commit();
                return true;
            }
        } catch (Throwable t) {
        }
        return false;
    }
}

Related

  1. commit(Connection conn)
  2. commit(Connection conn)
  3. commit(Connection conn)
  4. commit(Connection conn)