Java JDBC Connection Close close(Connection con)

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

Description

close

License

Open Source License

Declaration

public static void close(Connection con) 

Method Source Code


//package com.java2s;
import java.sql.Connection;

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

public class Main {

    public static void close(Connection con) {
        try {//  w ww  . j a v  a2  s.  c  o  m
            if (con != null)
                con.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public static void close(PreparedStatement ps) {
        try {
            if (ps != null)
                ps.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public static void close(ResultSet rs) {
        try {
            if (rs != null)
                rs.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

Related

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