Here you can find the source of close(Connection connection)
Parameter | Description |
---|---|
connection | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
public static void close(Connection connection) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { /**//from w w w . j a va2 s. c om * Closes a {@link Connection}. * * @param connection * @throws SQLException */ public static void close(Connection connection) throws SQLException { if (connection != null) { connection.close(); connection = null; } } /** * Closes a {@link Statement}/{@link PreparedStatement}/{@link CallableStatement}. * * @param statement * @throws SQLException */ public static void close(Statement statement) throws SQLException { if (statement != null) { statement.close(); statement = null; } } /** * Closes a {@link ResultSet}. * * @param resultSet * @throws SQLException */ public static void close(ResultSet resultSet) throws SQLException { if (resultSet != null) { resultSet.close(); resultSet = null; } } }