String sql = "INSERT INTO tab1 values(?,?,?)";
pstmt = conn.prepareStatement(sql);
for (int i = 0; i < 6; i ++) {
pstmt.setString(1, UUID);
pstmt.setString(2, "字段");
pstmt.setString(3, "字段");
pstmt.addBatch();
}
pstmt.executeBatch();
使用JDBC的addBatch()方法提高数据库插入更新效率
最新推荐文章于 2023-02-02 11:02:14 发布