【问题标题】:Teradata jdbc executeBatch throws a weird error?Teradata jdbc executeBatch 抛出一个奇怪的错误?
【发布时间】: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,您可能无法使用那个老司机来解决这个问题。
  • 你是如何准备的?可以贴一下代码吗?

标签: java jdbc teradata


【解决方案1】:

最近有同样的问题:

  1. 如果可以,找出导致错误的最小数据子集
  2. 修改代码为不带批处理可选启动(不用于生产)

在我的情况下,它是一个单一的数值,其精度超过了它插入的列,但通常该错误消息隐藏了您遇到的任何问题(字段太大?没有更多磁盘空间?)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-25
    • 2018-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多