Java JDBC Collection Transaction commitAndClose(Connection conn)

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

Description

commit And Close

License

Open Source License

Declaration

public static void commitAndClose(Connection conn) throws SQLException 

Method Source Code

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

import java.sql.*;

public class Main {
    public static void commitAndClose(Connection conn) throws SQLException {
        if (conn != null) {
            try {
                conn.commit();//w w  w .  j  a v a2  s  .co m
            } finally {
                conn.close();
            }
        }

    }

    public static void close(Connection conn) throws SQLException {
        if (conn != null) {
            conn.close();
        }

    }

    public static void close(ResultSet rs) throws SQLException {
        if (rs != null) {
            rs.close();
        }

    }

    public static void close(Statement stmt) throws SQLException {
        if (stmt != null) {
            stmt.close();
        }

    }
}

Related

  1. commit(Connection conn)
  2. commit(Connection conn)
  3. commit(Connection conn)
  4. commit(Connection conn)
  5. commit(Connection connection)
  6. commitAndClose(Connection conn)
  7. commitAndClose(Connection connection)
  8. commitAndClose(Connection connection)
  9. commitEL(Connection conn)