Derby更新中的非原子批处理失败



什么是通过stmt.executeBatch()进行derby更新的非原子批处理失败?

很抱歉有人投了反对票。但是我有一个错误。我这样写代码:stmt.executeBatch(query);。实际上stmt.executeBatch();是正确的。

在另一个代码中,我设置了setAutoCommit(false),忘记将其设置为setAutoCommit(true),当我纠正这两个时,消息消失了。

表示在非原子批处理中"出现了问题"。"非原子批处理"位意味着(我认为)批处理涉及多个事务,不能全部回滚。

完整的异常消息很可能是这样的:

Exception in thread "main" org.apache.derby.client.am.BatchUpdateException: 
    Non-atomic batch failure. The batch was submitted, but at least one 
    exception occurred on an individual member of the batch. Use getNextException() 
    to retrieve the exceptions for specific batched elements.
        at org.apache.derby.client.am.Agent.endBatchedReadChain(Agent.java:267)
        at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(PreparedStatement.java:1596)
        at org.apache.derby.client.am.PreparedStatement.executeBatchX(PreparedStatement.java:1467)
        at org.apache.derby.client.am.PreparedStatement.executeBatch(PreparedStatement.java:945)
        at AOIB.main(AOIB.java:24)

显示(有效)"批处理中的一个或多个操作失败。我不能告诉你是哪个,但你可以通过调用getNextException()找到。

最新更新