Here you can find the source of closeResources(Connection conn, Statement pstmt, ResultSet rs)
public static void closeResources(Connection conn, Statement pstmt, ResultSet rs)
//package com.java2s; //License from project: Apache License import java.sql.*; public class Main { public static void closeResources(Connection conn, Statement pstmt, ResultSet rs) { if (null != rs) { try { rs.close();//from w w w . j a v a 2 s .co m } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } finally { if (null != pstmt) { try { pstmt.close(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } finally { if (null != conn) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } } } } } } } }