Java Utililty Methods SQL ResultSet Close

List of utility methods to do SQL ResultSet Close

Description

The list of methods to do SQL ResultSet Close are organized into topic(s).

Method

voidcloseAllConnections(PreparedStatement preparedStatement, Connection connection, ResultSet resultSet)
Utility method to close the connection streams.
closeConnection(connection);
closeResultSet(resultSet);
closeStatement(preparedStatement);
voidcloseConnections(Connection conn, Statement st, ResultSet res)
close Connections
if (res == null)
    throw new IllegalArgumentException("Trying to close a null result set.");
res.close();
closeConnections(conn, st);
ListcloseCursor(Statement stmt, ResultSet rows)
close Cursor
List<String> exceptions = new ArrayList<String>();
try {
    if (rows != null)
        rows.close();
} catch (SQLException e) {
    exceptions.add(e.getMessage());
try {
...
voidcloseDatabaseResources(PreparedStatement prepStmt, ResultSet rs, Connection con)
This method releases this PrepareStatement,ResultSet and Connection object's database and JDBC resources.
if (prepStmt != null) {
    prepStmt.close();
if (rs != null) {
    rs.close();
if (con != null) {
    con.close();
...
voidcloseDbObjects(Connection conn, Statement stmt, ResultSet res)
close Db Objects
try {
    if (res != null) {
        res.close();
catch (Exception ex) {
try {
...
voidcloseEL(ResultSet rs)
close EL
if (rs != null) {
    try {
        rs.close();
    } catch (Throwable t) {
voidcloseQuietly(Connection conn, Statement stmt, ResultSet rs)
close Quietly
if (rs != null) {
    try {
        rs.close();
    } catch (SQLException e) {
if (stmt != null) {
    try {
...
voidcloseQuietly(Connection conn, Statement stmt, ResultSet rs)
Quietly closes JDBC objects (exceptions are swallowed).
if (null != rs) {
    try {
        rs.close();
        rs = null;
    } catch (Exception ex) {
if (null != stmt) {
...
voidcloseQuietly(Connection conn, Statement stmt, ResultSet rs)
Close a Connection, Statement and ResultSet.
closeQuietly(rs);
closeQuietly(stmt);
closeQuietly(conn);
voidcloseQuietly(final ResultSet resultSet)
Closes the given result set quietly - no logging, no exceptions
if (null != resultSet) {
    try {
        resultSet.close();
    } catch (final SQLException se) {