Java SQL ResultSet Close close(ResultSet rs)

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

Description

Close the result set and ignores thrown SQLExceptions.

License

Open Source License

Parameter

Parameter Description
rst ResultSet

Declaration

public static void close(ResultSet rs) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008 Ingres Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://  www. j a va 2  s . c  o m
 *    Ingres Corporation - initial API and implementation
 *******************************************************************************/

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Main {
    /**
     * Close the statement and ignores thrown SQLExceptions.
     * 
     * @param stmt
     *            Statement
     */
    public static void close(Statement stmt) {
        try {
            if (stmt != null) {
                stmt.close();
            }
        } catch (SQLException e) {
            // ignored
        }
    }

    /**
     * Close the result set and ignores thrown SQLExceptions.
     * 
     * @param rst
     *            ResultSet
     */
    public static void close(ResultSet rs) {
        try {
            if (rs != null) {
                rs.close();
            }
        } catch (SQLException e) {
            // ignored
        }
    }
}

Related

  1. close(ResultSet resultSet, CallableStatement statement, Connection connection)
  2. close(ResultSet resultSet, Statement statement, Connection connection)
  3. close(ResultSet resultSet, Statement statement, Connection connection)
  4. close(ResultSet resultSet, Statement statement, Connection connection)
  5. close(ResultSet rs)
  6. close(ResultSet rs)
  7. close(ResultSet rs)
  8. close(ResultSet rs, PreparedStatement pstmt, Connection con)
  9. close(ResultSet rs, Statement ps, Connection con)