Here you can find the source of close(Connection con, Statement stmt, ResultSet rs)
public static void close(Connection con, Statement stmt, ResultSet rs)
//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; import java.sql.Statement; public class Main { public static void close(Connection con, Statement stmt, ResultSet rs) { if (rs != null) { try { rs.close();//from ww w .ja v a2s. co m } catch (SQLException e) { System.out.println("5--SQLException"); e.printStackTrace(); } } if (stmt != null) { try { stmt.close(); } catch (SQLException e) { System.out.println("6-SQLException"); e.printStackTrace(); } } if (con != null) { try { con.close(); } catch (SQLException e) { System.out.println("7-closeSQLException"); e.printStackTrace(); } } } public static void close(Connection con, PreparedStatement pstmt, ResultSet rs) { if (rs != null) { try { rs.close(); } catch (SQLException e) { System.out.println("8-SQLException"); e.printStackTrace(); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException e) { System.out.println("9-SQLException"); e.printStackTrace(); } } if (con != null) { try { con.close(); } catch (SQLException e) { System.out.println("10-closeSQLException"); e.printStackTrace(); } } } public static void close(Connection con) { if (con != null) { try { con.close(); } catch (SQLException e) { System.out.println("11-closeSQLException"); e.printStackTrace(); } } } }