Java preparedstatement的executebatch()未返回添加的批数
我试图从一个准备好的语句中添加批次,精确到3000次,但是当调用Java preparedstatement的executebatch()未返回添加的批数,java,mysql,jdbc,teiid,Java,Mysql,Jdbc,Teiid,我试图从一个准备好的语句中添加批次,精确到3000次,但是当调用executebatch()时,返回的受影响行数是2048,对于大于2048的值add batch call语句,会发生这种情况。从哪里返回计数2048,我无法猜测。谁能帮我一下吗 以下是我的代码: while (resultSet.next()) { for (int i = 0,j=0; i < noOfColumns && j < noOfColumns; i++) {
executebatch()
时,返回的受影响行数是2048,对于大于2048的值add batch call语句,会发生这种情况。从哪里返回计数2048,我无法猜测。谁能帮我一下吗
以下是我的代码:
while (resultSet.next()) {
for (int i = 0,j=0; i < noOfColumns && j < noOfColumns; i++) {
//Setting values here for preparedStatement using setString()
}
pstmt.addBatch(); ==> this is called for more than 3000 times
try {
if(++count % batchSize == 0){
updatedCnt=pstmt.executeBatch(); ==> Here batch size is set to 3000 and executebatch returns 2048
successRowCnt = successRowCnt + updatedCnt.length;
}
if (count ==numberofRowsForCloning) {
isResultMatch = false;
break;
}
}
}
while(resultSet.next()){
对于(int i=0,j=0;i调用此函数的次数超过3000次
试一试{
如果(++计数%batchSize==0){
updatedCnt=pstmt.executeBatch();=>此处批大小设置为3000,executeBatch返回2048
successRowCnt=successRowCnt+updatedCnt.length;
}
如果(计数==行数循环){
isResultMatch=false;
打破
}
}
}
批量插入的TEID默认限制为2048
来自文档:MaxPreparedInsertBatchSize准备好的文件的最大大小 插入批次。2048年
尝试将属性
MaxPreparedInsertBatchSize
配置为所需的大小请记住,处理内存通常会受到限制。JDBC实现可能会限制最大批数。关于可用内存,它也可能受到限制。您的代码仍然缺少@Bernard的完整和可验证部分,我使用了java.sql.PreparedStatement并从java.sql.Connection创建了它,您能指出哪里可以找到批处理的限制吗?@ManojMajumdar executeBatch返回一个数组。您的意思是返回数组的长度为2048吗?你能显示变量声明吗?@ManojMajumdar你正在使用的JDBC驱动程序是什么?有些驱动程序对批处理操作有限制。非常感谢!!我一直在努力寻找同样的答案。谢谢@Bernard给我的提示。