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

voidcloseQuietly(ResultSet res)
close Quietly
try {
    if (res != null)
        res.close();
} catch (SQLException se) {
voidcloseQuietly(ResultSet resultSet)
close Quietly
try {
    closeResultSet(resultSet);
} catch (SQLException e) {
voidcloseQuietly(ResultSet resultSet)
close Quietly
if (resultSet == null)
    return;
try {
    resultSet.close();
} catch (Exception exception) {
voidcloseQuietly(ResultSet rs)
Close a ResultSet and ignore any errors during closing.
if (rs != null) {
    try {
        rs.close();
    } catch (SQLException ignore) {
voidcloseResource(Connection conn, Statement stmt, ResultSet rs)
Closes the resource if they are available.
if (rs != null) {
    try {
        rs.close();
    } catch (SQLException e) {
if (stmt != null) {
    try {
...
voidcloseResources(Connection conn, Statement pstmt, ResultSet rs)
close Resources
if (null != rs) {
    try {
        rs.close();
    } catch (SQLException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (null != pstmt) {
...
voidcloseResources(Connection conn, Statement stmt, ResultSet rs)
close Resources
if (rs != null) {
    try {
        rs.close();
    } catch (SQLException e) {
        System.err.println("Error closing ResultSet: " + e.getMessage());
if (stmt != null) {
...
voidcloseResources(Connection conn2, Statement statement, ResultSet rs)
close Resources
if (null != rs) {
    try {
        rs.close();
    } catch (SQLException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (null != statement) {
...
voidcloseResultAndStatement(Statement statement, ResultSet resultSet)

Helper method to close the JDBC interface(result set, statement).

try {
    if (resultSet != null) {
        resultSet.close();
} finally {
    closeStatement(statement);
voidcloseResultSet(final ResultSet resultSet)
Close the given JDBC ResultSet and ignore any thrown exception.
if (resultSet != null) {
    try {
        resultSet.close();
    } catch (final SQLException ex) {