What does return value -3 indicate when sending a JDBC bulk insert to

I try to do Batch inserts with JDBC to a Crate instance:

    for(...) {
        statement.setLong(1, startTime);
        statement.setInt(2, i);

    results = uaStatement.executeBatch();"Had bulk-result: " + Arrays.toString(results));

The resulting int[] array should contain 0 or 1 depending if the row was inserted or not.

But I get back lots of "-3", which neither the JDBC standard nor the doc seems to define.

It seems the rows don't get inserted when -3 is returned, but no additional error information is visible. It seems the -3 is coming directly from the Crate server and the client-side JDBC implementation just forwards this.

This is crate 2.3.3 with JDBC driver 2.2.0

compile 'io.crate:crate-jdbc:2.2.0'

What does this indicate? Some problem with the sent values?

Had bulk-result: [1, 1, 1, 1, -3, -3, -3, -3, -3, -3, 1, -3, -3, -3, -3, -3, -3, ...


  • Please check the API documentation of java.sql.BatchUpdateException (emphasis mine):

    After a command in a batch update fails to execute properly and a BatchUpdateException is thrown, the driver may or may not continue to process the remaining commands in the batch. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will have an element for every command in the batch rather than only elements for the commands that executed successfully before the error. In the case where the driver continues processing commands, the array element for any command that failed is Statement.EXECUTE_FAILED.

    and Statement.executeBatch():

    A value of EXECUTE_FAILED -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails

    Value -3 is constant Statement.EXECUTE_FAILED. In some drivers the exceptions of those execution failures will be chained to this BatchUpdateException (check getNextException or iterate over all throwables of the exception).

    However, if all subsequent values report Statement.EXECUTE_FAILED, it might mean that the driver does not actually try to execute the remaining parameter sets, but instead simply reports Statement.EXECUTE_FAILED for all parameter sets from the first failure on. In that case a driver should 'give up' after the first failure and only report the update counts of the successfully executed parameter sets, as described in the JDBC specification and API documentation.