Here you can find the source of closeAll(Connection conn, Statement stmt, ResultSet rs)
Description:TODO
Parameter | Description |
---|---|
conn | a parameter |
stmt | a parameter |
rs | a parameter |
protected static void closeAll(Connection conn, Statement stmt, ResultSet rs)
//package com.java2s; //License from project: Apache License import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { /**/*from ww w . jav a 2 s . co m*/ * <p>Description:TODO</p> * @param conn * @param pstmt * @param rs * @author lijw * @since 2013-3-5 */ protected static void closeAll(Connection conn, PreparedStatement pstmt, ResultSet rs) { if (null != rs) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { rs = null; } } if (null != pstmt) { try { pstmt.close(); } catch (SQLException e) { e.printStackTrace(); } finally { pstmt = null; } } if (null != conn) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } finally { conn = null; } } } /** * <p>Description:TODO</p> * @param conn * @param stmt * @param rs * @author lijw * @since 2013-3-5 */ protected static void closeAll(Connection conn, Statement stmt, ResultSet rs) { if (null != rs) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { rs = null; } } if (null != stmt) { try { stmt.close(); } catch (SQLException e) { e.printStackTrace(); } finally { stmt = null; } } if (null != conn) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } finally { conn = null; } } } /** * <p>Description:TODO</p> * @param conn * @param pstmt * @author lijw * @since 2013-3-5 */ protected static void closeAll(Connection conn, PreparedStatement pstmt) { if (null != pstmt) { try { pstmt.close(); } catch (SQLException e) { e.printStackTrace(); } finally { pstmt = null; } } if (null != conn) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } finally { conn = null; } } } /** * <p>Description:TODO</p> * @param conn * @param pstmt * @author lijw * @since 2013-3-5 */ protected static void closeAll(Connection conn, CallableStatement cs) { if (null != cs) { try { cs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { cs = null; } } if (null != conn) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } finally { conn = null; } } } }