Here you can find the source of closeConnections(Connection conn, Statement st, ResultSet res)
Parameter | Description |
---|---|
conn | a parameter |
st | a parameter |
res | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
private static void closeConnections(Connection conn, Statement st, ResultSet res) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { /**//from ww w.j a v a 2s. co m * @param conn * @param st * @param res * @throws SQLException */ private static void closeConnections(Connection conn, Statement st, ResultSet res) throws SQLException { if (res == null) throw new IllegalArgumentException("Trying to close a null result set."); res.close(); closeConnections(conn, st); } /** * @param conn * @param st * @throws SQLException */ private static void closeConnections(Connection conn, Statement st) throws SQLException { if (st == null) throw new IllegalArgumentException("Trying to close a null statement."); else st.close(); if (conn == null) throw new IllegalArgumentException("Trying to close a null connection."); else conn.close(); } }