Here you can find the source of closeResource(Connection conn, Statement stmt, ResultSet rs)
Parameter | Description |
---|---|
conn | the <code>Connection</code> to close. |
stmt | the <Code>Statement</code> to close. |
rs | the <code>ResultSet</code> to close. |
static final void closeResource(Connection conn, Statement stmt, ResultSet rs)
//package com.java2s; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { /**/*from w ww . j a v a 2s. c o m*/ * Closes the resource if they are available. * @param conn the <code>Connection</code> to close. * @param stmt the <Code>Statement</code> to close. * @param rs the <code>ResultSet</code> to close. */ static final void closeResource(Connection conn, Statement stmt, ResultSet rs) { if (rs != null) { try { rs.close(); } catch (SQLException e) { // ignore } } if (stmt != null) { try { stmt.close(); } catch (SQLException e) { // ignore } } if (conn != null) { try { conn.close(); } catch (SQLException e) { // ignore } } } }