Here you can find the source of closeAll(ResultSet rs, Statement st, Connection conn)
Parameter | Description |
---|---|
rs | ResultSet to be closed |
st | Statement (or subclass) to be closed |
conn | Connection to be closed |
public static void closeAll(ResultSet rs, Statement st, Connection conn) throws SQLException
//package com.java2s; /** Copyright (C) (MSA, Inc) All rights reserved. ** General Public License: http://www.opensource.org/licenses/gpl-license.php **/// ww w . jav a2 s . com import java.sql.*; public class Main { /** Convenience method for closing sql objects. Closing is tried on ** all objects, independent of errors/exceptions in previous closes. * @param rs ResultSet to be closed * @param st Statement (or subclass) to be closed * @param conn Connection to be closed * @exception SQLException when any problem occurs while closing objects */ public static void closeAll(ResultSet rs, Statement st, Connection conn) throws SQLException { try { if (rs != null) { rs.close(); } } finally { try { if (st != null) { st.close(); } } finally { if (conn != null) { conn.close(); } } } } }