jdbc怎么让连接关闭
这篇文章主要讲解了“jdbc怎么让连接关闭”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“jdbc怎么让连接关闭”吧!

成都创新互联公司基于分布式IDC数据中心构建的平台为众多户提供川西大数据中心 四川大带宽租用 成都机柜租用 成都服务器租用。
public Boolean exeUpdateSql(String sql){
// log.info("cliockhouse 执行更新sql:" + sql);
Connection connection = getConn();
Statement statement = null;
ResultSet results=null;
try {
statement = connection.createStatement();
results = statement.executeQuery(sql);
return true;
} catch (Exception e) {
e.printStackTrace();
MyExceptionUtils.getExceptionInfo(e);
return false;
}finally {
if(connection!=null){
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
connection = null;
}
if(results!=null){
try {
results.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
results = null;
}
if(statement!=null){
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
return false;
}
statement = null;
}
}
}感谢各位的阅读,以上就是“jdbc怎么让连接关闭”的内容了,经过本文的学习后,相信大家对jdbc怎么让连接关闭这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
当前标题:jdbc怎么让连接关闭
文章转载:http://www.cqwzjz.cn/article/psdccp.html


咨询
建站咨询
