Here you can find the source of close(Connection connection)
Closes the sql connection.
Parameter | Description |
---|---|
connection | the connection to be closed. |
private static void close(Connection connection)
//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 } } } }