Java SQL ResultSet Close closeRS(final ResultSet rs)

Here you can find the source of closeRS(final ResultSet rs)

Description

close RS

License

Open Source License

Declaration

static void closeRS(final ResultSet rs) 

Method Source Code


//package com.java2s;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    static void closeRS(final ResultSet rs) {
        try {/*from  w  w  w  . j  a v a  2s.  co  m*/
            if (rs != null) {
                rs.close();
            }
        } catch (final SQLException ignore) {
            // ignored
        }
    }

    static void close(final PreparedStatement ps, final ResultSet rs) {
        closePS(ps);
        closeRS(rs);
    }

    static void closePS(final PreparedStatement ps) {
        try {
            if (ps != null) {
                ps.close();
            }
        } catch (final SQLException ignore) {
            // ignored
        }
    }
}

Related

  1. closeResultSet(ResultSet rs)
  2. closeResultSetAndStatement(ResultSet rs)
  3. closeResultSetAndStatement(Statement statement, ResultSet resultSet)
  4. closeResultSets(List results)
  5. closeResultSets(List resultSets)