public static int executeNotQuery(String sql) {
int num = 0;
// 1.得到链接对象
Connection conn = getConnection();
// 2.创建命令执行对象
Statement stm = null;
try {
stm = conn.createStatement();
// 3.执行sql脚本 得到返回值
num = stm.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
} finally {
close(null, stm, conn);
}
return num;
}
int num = 0;
// 1.得到链接对象
Connection conn = getConnection();
// 2.创建命令执行对象
Statement stm = null;
try {
stm = conn.createStatement();
// 3.执行sql脚本 得到返回值
num = stm.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
} finally {
close(null, stm, conn);
}
return num;
}