Here you can find the source of close(Connection connection)
public static void close(Connection connection)
//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); } }