问题描述
我有一个应用程序处理一个非常大的文件并将数据发送到oracle数据库(使用Java 6,oracle 9)。在一个循环中,我使用一个 PreparedStatement ps
并创建所有使用 ps.addBatch()
。
我有一种情况,一个 BatchUpdateException bue
是在 ps.executeBatch()
中的某个地方抛出。在这一点上,批处理停止执行。
我希望批处理执行继续,以便我可以在方法中检查失败的更新 processUpdateCounts(bue.getUpdateCounts())
。
关于BatchUpdateException类的javadoc说:
有没有执行延续的方式,还是需要修改程序,以便单独执行该语句?
刚刚找到此链接:
显然,它表示有
谢谢
(抱歉找不到更好找到上面的链接)。
I have an application which processes a very large file and sends data to an oracle database (using Java 6, oracle 9).
In a loop, I use a PreparedStatement ps
and create all SQL statements generated with ps.addBatch()
.
I have a situation where a BatchUpdateException bue
is thrown somewhere during the ps.executeBatch()
. At that point, the batch stops to be executed.
I'd like the batch execution to continue, so that I can then check on failed updates in a method processUpdateCounts(bue.getUpdateCounts())
.
The javadoc about class BatchUpdateException says:
Is there a way to enforce continuation or do I need to alter my program so that it will execute the statement individually?
Just found this link:JDBC Batch Update Problem
Apparently, it says there there is
thus I am resorting to sending the inserts one by one.Thank you
(sorry for not looking better to find the link above before).
这篇关于BatchUpdateException:批处理不会终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!