UnableToExecuteStatementException: packet writing was aborted. Raise getNextException to see the reason.

Usage @SqlBatchfor batch database update

@SqlBatch("<SQL Command>")
@BatchChunkSize(INSERT_BATCH_SIZE)
void insert(@BindBean Iterator<SomeObj> someObj);

and I get this error:

org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: java.sql.BatchUpdateException: Batch write 0 ... was aborted. Call getNextException to see the reason.

The problem is that when detected is UnableToExecuteStatementException, not the original BatchUpdateException, so I can not call getNextExceptionto see the reason. Alternatively, I can simply run the SQL command in the database.

Any idea how to get to the bottom of the matter or what could be the problem?

0
source share
1 answer

​​ Hibernate Postgres. , PostgreSQL (org.postgresql.core.v3.QueryExecutorImpl).

, , :

java.sql.BatchUpdateException: Batch entry 0 INSERT INTO myscheme.table_name (list,of,column,names,...) VALUES (9007199314139196, 'F', 27, 625, 625, 625, 625, 625, 28), (9007199314139198, 'T', 2395, 2369, 2369, 2369, 2369, 2369, 2389), ... was aborted.  Call getNextException to see the cause.

.

,

    } catch(JDBCConnectionException t) {
        System.out.println("================ {{{");
        SQLException current = t.getSQLException();
        do {
           current.printStackTrace();
        } while ((current = current.getNextException()) != null);
        System.out.println("================ }}}");
        throw t;
    }

:

Caused by: java.io.IOException: Tried to send an out-of-range integer as a 2-byte value: 33300

. 33300 - . , .

at org.postgresql.core.v3.QueryExecutorImpl.sendParse(QueryExecutorImpl.java:1329)

pgStream.SendInteger2(params.getParameterCount()); // # of parameter types specified

?

, .. , , 32767 INSERT.

32767 , SQL INSERT.

0

Source: https://habr.com/ru/post/1626039/


All Articles