conn,stmt,rset 的关闭(规范)

     Connection conn = null;
Statement stmt = null;
ResultSet rset = null; try {
conn = dataSource.getConnection();
stmt = conn.createStatement();
rset = stmt.executeQuery("select 1 from dual");
} catch (SQLException e) {
e.printStackTrace();
} finally {
try { if (rset != null) rset.close(); } catch(Exception e) { }
try { if (stmt != null) stmt.close(); } catch(Exception e) { }
try { if (conn != null) conn.close(); } catch(Exception e) { }
}
上一篇:JS实现打印功能


下一篇:Ubuntu 16.04 curl 安装 使用