【问题标题】:Non Atomic Batch Failure in Derby UpdateDerby 更新中的非原子批处理失败
【发布时间】:2013-04-29 06:22:31
【问题描述】:

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

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

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

【问题讨论】:

    标签: java derby


    【解决方案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() 找出答案。”

    【讨论】:

    • 意思是“出了点问题”我知道。但是为什么会这样呢?
    • @PranjalCholadhara - 我们不能告诉你,因为异常消息没有说明。您需要致电getNextException() 并打印出来以找出...就像消息告诉您的那样。
    • 有关解释您的异常的更多帮助:wiki.apache.org/db-derby/UnwindExceptionChain
    猜你喜欢
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    • 2015-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多