50,503
社区成员
发帖
与我相关
我的任务
分享
public Boolean JdbcUpdate (List<String> sqls, List<Object[]> args) {
Connection conn = null;
PreparedStatement stmt = null;
Boolean res = false;
try {
conn = getDataSource().getConnection();
conn.setAutoCommit(false);
for (int i = 0; i < sqls.size(); i++) {
stmt = conn.prepareStatement(sqls.get(i));
for (int j = 0; j < args.get(i).length; j++) {
stmt.setObject(j + 1, args.get(i)[j]);
}
int res1 = 0;
res1 = stmt.executeUpdate();
res1 = res1;
}
conn.commit();
res = true;
}
catch(Exception e){……}
}