Here you can find the source of closeAll(ResultSet rs)
public static void closeAll(ResultSet rs)
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void closeAll(ResultSet rs) { Statement stmt = null;/*w ww. j a va 2 s . c o m*/ Connection conn = null; try { stmt = rs.getStatement(); conn = stmt.getConnection(); } catch (SQLException e) { } finally { closeResultSet(rs); closeStatement(stmt); closeConnection(conn); } } public static void closeResultSet(ResultSet rs) { try { rs.close(); } catch (SQLException e) { } } public static void closeStatement(Statement stmt) { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { } } } public static void closeConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } }