Connection conn = null;
ResultSet rs = null;
preparedStatement pss = null;
try
{
conn = dataSource.getConnection(USERID,pASSWORD);
pss = conn.prepareStatement("SELECT SAVESERIALZEDDATA FROM SESSION.pINGSESSION3DATA WHERE SESSIONKEY = ?");
pss.setString(1,sessionKey);
rs = pss.executeQuery();
pss.close();
conn.close();
}
catch (Throwable t)
{
// Insert Appropriate Error Handling Here
}
finally
{
// The finally clause is always executed - even in error
// conditions preparedStatements and Connections will always be closed
try
{
if (pss != null)
pss.close();
}
catch(Exception e) {}
try
{
if (conn != null)
conn.close();
}
catch (Exception e){}
}
}
connection 关闭方法
最新推荐文章于 2018-12-14 10:32:57 发布