Java SQL ResultSet Close close(Connection conn, Statement st, ResultSet rs)

Here you can find the source of close(Connection conn, Statement st, ResultSet rs)

Description

close

License

LGPL

Declaration

public static void close(Connection conn, Statement st, ResultSet rs) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.sql.Connection;

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

public class Main {
    public static void close(Connection conn, PreparedStatement pst, ResultSet rs) {
        try {/*from  w w w . ja v a 2s.c  o m*/
            if (rs != null)
                rs.close();
            else if (pst != null)
                pst.close();
            else if (conn != null)
                conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void close(Connection conn, Statement st, ResultSet rs) {
        try {
            if (rs != null)
                rs.close();
            else if (st != null)
                st.close();
            else if (conn != null)
                conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

Related

  1. close(Connection c, Statement s, ResultSet r)
  2. close(Connection con, Statement stmt, ResultSet rs)
  3. close(Connection conn, PreparedStatement ps, 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)
  7. close(final PreparedStatement ps, final ResultSet rs)
  8. close(final ResultSet rs, final Statement st)