Code example for ResultSet

Methods: close

0
 
 
    public static Object execute(ResultSet rs, ResultSetCallback rsCallback) {
        try { 
            if (rsCallback != null && rs != null) {
                return rsCallback.doInResultSet(rs);
            } 
        } 
        catch (SQLException e) {
            log.error("doInResultSet failed", e);
        } 
        finally { 
            close(rs);
        } 
        return null; 
    } 
 
 
    public static void close(PreparedStatement preparedStatement) {
        if (preparedStatement != null) {
            try { 
                preparedStatement.close();
            } 
            catch (SQLException e) {
                log.error("Close PreparedStatement failed", e);
            } 
 
        } 
    } 
 
 
    public static void close(ResultSet rs) {
        if (rs != null) {
            try { 
                rs.close();
            } 
            catch (SQLException ex) {
                log.error("Close ResultSet failed", ex);
            } 
        }