Java SQL ResultSet Close close(Connection conn, PreparedStatement ps, ResultSet rs)

Here you can find the source of close(Connection conn, PreparedStatement ps, ResultSet rs)

Description

close

License

Open Source License

Declaration

public static void close(Connection conn, PreparedStatement ps, ResultSet rs) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static void close(Connection conn, PreparedStatement ps, ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();//w w  w.j  a  v  a 2  s . c  o m
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if (ps != null) {
            try {
                ps.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}

Related

  1. close(Connection c, Statement s, ResultSet r)
  2. close(Connection con, Statement stmt, ResultSet rs)
  3. close(Connection conn, Statement st, ResultSet rs)
  4. close(Connection conn, Statement st, ResultSet rs)
  5. close(Connection connection, PreparedStatement statement, ResultSet resultSet)
  6. close(Connection connection, Statement statement, ResultSet resultSet)