Java JDBC Connection Close close(Connection conn)

Here you can find the source of close(Connection conn)

Description

Close.

License

Open Source License

Parameter

Parameter Description
conn the conn

Declaration

public static void close(Connection conn) 

Method Source Code

//package com.java2s;

import java.sql.Connection;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import java.sql.Statement;

public class Main {
    /**//www. java2  s .  c  o m
     * Close.
     *
     * @param conn
     *            the conn
     */
    public static void close(Connection conn) {
        if (conn != null)
            try {
                conn.close();
            } catch (Exception e) {
            }
    }

    /**
     * Close.
     *
     * @param stmt
     *            the stmt
     */
    public static void close(Statement stmt) {
        if (stmt != null)
            try {
                stmt.close();
            } catch (Exception e) {
            }
    }

    /**
     * Close.
     *
     * @param rs
     *            the rs
     */
    public static void close(ResultSet rs) {
        if (rs != null)
            try {
                rs.close();
            } catch (Exception e) {
            }
    }

    /**
     * Close.
     *
     * @param ps
     *            the ps
     */
    public static void close(PreparedStatement ps) {
        if (ps != null)
            try {
                ps.close();
            } catch (Exception e) {
            }
    }

    /**
     * Close.
     *
     * @param conn
     *            the conn
     * @param ps
     *            the ps
     */
    public static void close(Connection conn, PreparedStatement ps) {
        close(ps);
        close(conn);
    }

    /**
     * Close.
     *
     * @param conn
     *            the conn
     * @param stmt
     *            the stmt
     */
    public static void close(Connection conn, Statement stmt) {
        close(stmt);
        close(conn);
    }

    /**
     * Close.
     *
     * @param conn
     *            the conn
     * @param ps
     *            the ps
     * @param rs
     *            the rs
     */
    public static void close(Connection conn, PreparedStatement ps, ResultSet rs) {
        close(rs);
        close(ps);
        close(conn);
    }

    /**
     * Close.
     *
     * @param conn
     *            the conn
     * @param stmt
     *            the stmt
     * @param rs
     *            the rs
     */
    public static void close(Connection conn, Statement stmt, ResultSet rs) {
        close(rs);
        close(stmt);
        close(conn);
    }

    /**
     * Close.
     *
     * @param ps
     *            the ps
     * @param rs
     *            the rs
     */
    public static void close(PreparedStatement ps, ResultSet rs) {
        close(rs);
        close(ps);
    }

    /**
     * Close.
     *
     * @param stmt
     *            the stmt
     * @param rs
     *            the rs
     */
    public static void close(Statement stmt, ResultSet rs) {
        close(rs);
        close(stmt);
    }
}

Related

  1. close(Connection con)
  2. close(Connection con)
  3. close(Connection conn)
  4. close(Connection conn)
  5. close(Connection conn)
  6. close(Connection conn)