I am trying to load the data from splunk to teradata using JDBC driver.As nick highlighted in previous post we are not able to load null value in to the table.
Following is the error I am getting
[Teradata JDBC driver][TeraJDBC 14.10.00.17][Error 1063][SQLState HY000] null is not supported as a data value with this variant of the setObject method; use the setNull method or the setObject method with a targetSqlType parameter
Please help out in fixing the issue.
Let's assume you have an Object with a null value in your application:
Object obj = null ;
The error message is indicating that your application cannot use the PreparedStatement.setObject(int,Object) method to bind the null value:
PreparedStatement ps = con.prepareStatement ... ;
ps.setObject(1, obj) ; // will throw exception if obj is null
Instead, your application must specify the data type of the null value using one or the other of these methods:
ps.setObject(1, obj, Types.VARCHAR) ; // or some other java.sql.Types constant
ps.setNull(1, Types.VARCHAR) ; // or some other java.sql.Types constant
The Teradata Database requires the data type to be specified for a NULL value, so the Teradata JDBC Driver, in turn, must require the application to specify the java.sql.Types constant for a null value.