Java SQL ResultSet Close closeQuietly(ResultSet rs)

Here you can find the source of closeQuietly(ResultSet rs)

Description

Close a ResultSet and ignore any errors during closing.

License

Open Source License

Declaration

public static void closeQuietly(ResultSet rs) 

Method Source Code

//package com.java2s;

import java.sql.*;

public class Main {
    /**/*from   w  w w.j  av  a2s  .c o  m*/
     * Close a Connection and ignore any errors during closing.
     */
    public static void closeQuietly(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException ignore) {
            }
        }
    }

    /**
     * Close a Statement and ignore any errors during closing.
     */
    public static void closeQuietly(Statement stmt) {
        if (stmt != null) {
            try {
                stmt.close();
            } catch (SQLException ignore) {
            }
        }
    }

    /**
     * Close a ResultSet and ignore any errors during closing.
     */
    public static void closeQuietly(ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException ignore) {
            }
        }
    }
}

Related

  1. closeQuietly(Connection conn, Statement stmt, ResultSet rs)
  2. closeQuietly(final ResultSet resultSet)
  3. closeQuietly(ResultSet res)
  4. closeQuietly(ResultSet resultSet)
  5. closeQuietly(ResultSet resultSet)
  6. closeResource(Connection conn, Statement stmt, ResultSet rs)
  7. closeResources(Connection conn, Statement pstmt, ResultSet rs)
  8. closeResources(Connection conn, Statement stmt, ResultSet rs)
  9. closeResources(Connection conn2, Statement statement, ResultSet rs)