java - preparedstatement 的 executebatch() 不返回添加的批处理数

标签 java mysql jdbc teiid

我正在尝试从准备好的语句中添加批处理,精确到 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 配置为您需要的大小。

请记住,这通常仅限于处理内存。

关于java - preparedstatement 的 executebatch() 不返回添加的批处理数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53223079/

相关文章:

java - 错误: "Failed to create sessionFactory object.org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class <POJO>"

java - 你能创建一个不以 Object 作为其基类的类结构吗

java - 在Android中使用Java生成二维码

mysql - 按特殊顺序对表记录进行排序

具有特殊字符的 PHP Json 输出

java - PgJDBC : "no suitable driver found" when following tutorial, 为什么?

基于Java的WS用户授权

java - 在 mousePressed 处更改 2 个图像

php - 如何将数学 mysql 查询应用于数据库中的每一行?

php - SQL如何查出数据位于哪个表