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

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

Description

close

License

Apache License

Declaration

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

Method Source Code


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

import java.sql.Connection;

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

public class Main {
    public static void close(ResultSet rs, Statement st, Connection conn) {
        try {/*  ww  w  . jav  a2s. c o  m*/
            if (rs != null) {
                rs.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (st != null) {
                    st.close();
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } finally {
                if (conn != null) {
                    try {
                        conn.close();
                    } catch (SQLException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

    }
}

Related

  1. close(ResultSet rs)
  2. close(ResultSet rs, PreparedStatement pstmt, Connection con)
  3. close(ResultSet rs, Statement ps, Connection con)
  4. close(ResultSet rs, Statement ps, Connection conn)
  5. close(ResultSet rs, Statement st, Connection con)
  6. close(ResultSet rs, Statement stmt)
  7. close(ResultSet rs, Statement stmt, Connection con)
  8. close(ResultSet rs, Statement stmt, Connection con)
  9. close(ResultSet rs, Statement stmt, Connection con)