1
votes

In one of my application i was trying to save one file (Size of the file is 2MB) in to the teradata database table as a BLOB data by using JDBC connection. But everytime i was getting one exception which is as follows

com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.00.00.01] [Error 1186] [SQLState HY000] Parameter 2 length is 2215538 bytes, which is greater than the maximum 64000 bytes that can be set.

Please help me out resolving this issue.

Thanks, Sourav

2
What is the target table definition? Sounds like you are trying to put 10 lb of 'data' in a 5 lb 'bag'.Rob Paller

2 Answers

0
votes

Try to set the blob column larger ,or just use the system default value ,which is 2097088000 btw.

This is from Teradata User Documentations : SQL data types and literals Chapter 7 "the number of bytes to allocate for the BLOB column. The maximum number of bytes is 2097088000, which is the default if n is not specified."

0
votes

Assuming you have data in String format we can use setCharacterStream to bypass the restriction of 64000 bytes.

Using preparedStatement to insert large amount of data clob column as

pStmt.setCharacterStream(paramterIndex, new StringReader(StringToBeInserted), StringToBeInserted.length());