【发布时间】:2016-06-14 08:31:45
【问题描述】:
我使用jdbc 将原始数据集加载到 Teradata。直到最近我一直在PERFECT工作。
这里是代码
try {
prst.executeBatch();
}
catch (SQLException ex) {
System.out.println("Batch outside the loop error: ");
while (ex != null)
{
System.out.println(" Error code: " + ex.getErrorCode());
System.out.println(" SQL State: " + ex.getSQLState());
System.out.println(" Message: " + ex.getMessage());
ex.printStackTrace();
System.out.println();
ex = ex.getNextException();
}
}
但是昨天同样的代码抛出了一个错误。这是错误
[Teradata JDBC Driver] [TeraJDBC 13.00.00.16] [Error 1339] [SQLState HY000]
A failure occurred while executing a PreparedStatement batch request.
The parameter set was not executed and should be resubmitted
individually using the PreparedStatement executeUpdate method
我使用getNextException() 进行了检查,但我得到的只是相同的消息
A failure occurred while executing a PreparedStatement batch request.
The parameter set was not executed and should be resubmitted
individually using the PreparedStatement executeUpdate method
它在重复同样的事情,没有任何进一步的细节。我尝试按照here 的建议将批量大小减少到最小,但仍然没有结果。
什么可能导致此错误?如何克服它?
【问题讨论】:
-
您需要在 try/catch 上方添加代码。执行批处理之前发生了什么。此外,最近发生了什么变化会导致持续失败?
-
最近没有任何变化。不是一回事。准备好的语句
prst.executeBatch();会引发错误。通常这个错误是由于大批量大小而发生的。但我把它降到了最低限度 -
错误 1339 是一个非常普遍的错误。在您的堆栈跟踪中的某个地方,您应该希望有一个 SQLException。不过,根据documentation,您可能无法使用那个老司机来解决这个问题。
-
你是如何准备的?可以贴一下代码吗?