-2

德比更新中的非原子批处理失败是什么stmt.executeBatch()

很抱歉投反对票。但我得到了错误。:我写了这样的代码:stmt.executeBatch(query);. 其实stmt.executeBatch();是对的。

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

4

1 回答 1

1

这意味着非原子批次中的“出现问题”。“非原子批处理”位意味着(我认为)该批处理涉及多个事务并且不能全部回滚。

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

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()。”

于 2013-04-29T06:39:00.987 回答