美文网首页coder
PreparedStatement下批量执行返回结果问题

PreparedStatement下批量执行返回结果问题

作者: S拒绝拖延 | 来源:发表于2019-08-08 16:25 被阅读0次
PreparedStatement ps = conn.prepareStatement(sql);
ps.addBatch();
try{
      int[] count = ps.executeBatch();//数组的length代表所有执行成功的记录
}catch(BatchUpdateException e){
      int[] count = e.getUpdateCounts(); //数组中元素大于等于0的代表执行成功的记录,小于0为执行失败的记录
}

相关文章

网友评论

    本文标题:PreparedStatement下批量执行返回结果问题

    本文链接:https://www.haomeiwen.com/subject/fwgxjctx.html