Java JDBC Connection Close close(Connection connection)

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

Description

Closes the sql connection.

License

Open Source License

Parameter

Parameter Description
connection the connection to be closed.

Declaration

private static void close(Connection connection) 

Method Source Code

//package com.java2s;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Main {
    /**/*from   w w  w. ja va2  s .co  m*/
     * <p>
     * Closes the sql statement.
     * </p>
     * @param statement the statement to be closed.
     */
    private static void close(PreparedStatement statement) {
        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
                // ignore
            }
        }
    }

    /**
     * <p>
     * Closes the sql connection.
     * </p>
     * @param connection the connection to be closed.
     */
    private static void close(Connection connection) {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException e) {
                // ignore
            }
        }
    }
}

Related

  1. close(Connection conn)
  2. close(Connection conn)
  3. close(Connection connection)
  4. close(Connection connection)
  5. close(Connection connection)
  6. close(Connection rs)
  7. close(Object obj)
  8. closeConnection(Closeable... closes)
  9. closeIfNotNull(Connection conn)