Search code examples
javajdbcteradata

Teradata jdbc executeBatch throws a weird error?


I use jdbc to load raw data sets to Teradata. I has been working PERFECT until recently.

Here is the code

    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();
                }

        }

But yesterday the same code statred throwing an error. Here is the error

    [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 

I checked using getNextException() but all I get is the same message

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  

It's repeating the same stuff all over again without any further details. I tried to decrease the batch size to a minimum as recomended here but still no result.

What could possible cause this error ? How to overcome it ?


Solution

  • Had the same issue recently:

    1. if you can, identify the smallest subset of data that gives you the error
    2. modify the code to be optionally launched without batching (not for production use)

    In my case it was a single numeric value whose precision was more than the column it was inserted in, but generally that error message is hiding whatever issue you're encountering (a field too large? No more disk space?)