Here you can find the source of close(Connection connection, PreparedStatement statement, ResultSet resultSet)
Parameter | Description |
---|---|
connection | a parameter |
statement | a parameter |
resultSet | a parameter |
public static void close(Connection connection, PreparedStatement statement, ResultSet resultSet)
//package com.java2s; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Main { /**// w w w . j a v a2 s.c om * close dataSource * @param connection * @param statement * @param resultSet */ public static void close(Connection connection, PreparedStatement statement, ResultSet resultSet) { if (null != resultSet) { try { resultSet.close(); } catch (SQLException e) { System.err.println("close resultset error!"); } } if (null != statement) { try { statement.close(); } catch (SQLException e) { System.err.println("close statement error!"); } } if (null != connection) { try { connection.close(); } catch (SQLException e) { System.err.println("close connection error!"); } } } }