批处理
Statement 就是一种批处理
PreparedStatement 实现批处理是一条一条增加。
Statement 实现批处理是可以多条同时增加。
增加批处理的方法为:
addBatch() //将一组参数添加到此 PreparedStatement 对象的批处理命令中 例:addBatch("select * from student");
executeBatch() // 将一批命令提交给数据库来执行,如果全部命令执行成功,则返回更新计数组成的数组。 它的返回类型是数组。
例:int rows =stmt.executeBatch(); for(int i:rows) System.out.println(i);