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;
}
}
}
转载于:https://my.oschina.net/u/4131327/blog/3082396