Java JDBC Connection Close close(Connection connection)

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

Description

close

License

Apache License

Declaration

public static void close(Connection connection) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.*;

public class Main {

    public static void close(Connection connection, PreparedStatement preparedStatement, ResultSet resultSet) {
        try {//www .ja v a 2s  .  c  om
            if (connection != null) {
                connection.close();
            }
            if (preparedStatement != null) {
                preparedStatement.close();
            }
            if (resultSet != null) {
                resultSet.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public static void close(Connection connection) {
        close(connection, null, null);
    }

    public static void close(Connection connection, PreparedStatement preparedStatement) {
        close(connection, preparedStatement, null);
    }
}

Related

  1. close(Connection conn)
  2. close(Connection conn)
  3. close(Connection conn)
  4. close(Connection conn)
  5. close(Connection conn)
  6. close(Connection connection)
  7. close(Connection connection)
  8. close(Connection connection)
  9. close(Connection rs)