preparedstatement 的 executebatch() 不返回添加的批次数
executebatch() of preparedstatement not returning the number of batches added
我正在尝试从准备好的语句中添加批处理精确到 3000 次,但是当调用 executebatch()
时,返回的受影响行数为 2048,并且对于值添加批处理调用语句更大的值会发生这种情况比 2048。从哪里返回计数 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;
}
}
}
批量插入的 Teiid driver 的默认限制是 2048。
From Doc:
MaxPreparedInsertBatchSize The max size of a prepared
insert batch. 2048
尝试将 属性 MaxPreparedInsertBatchSize
配置为您需要的大小。
记住,这通常是处理内存的限制。
我正在尝试从准备好的语句中添加批处理精确到 3000 次,但是当调用 executebatch()
时,返回的受影响行数为 2048,并且对于值添加批处理调用语句更大的值会发生这种情况比 2048。从哪里返回计数 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;
}
}
}
批量插入的 Teiid driver 的默认限制是 2048。
From Doc:
MaxPreparedInsertBatchSize The max size of a prepared insert batch. 2048
尝试将 属性 MaxPreparedInsertBatchSize
配置为您需要的大小。
记住,这通常是处理内存的限制。