Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, February 24, 2012

Handling Character large objects in Java application

In my Java application, I have a stream of character data in a java.io.Reader object.
I am using a PreparedStatement object to insert data into a table containing such a large object column (datatype - text). I am using the following API call:
PreparedStatement.setCharacterStream(colIndex, reader, size);

In order to find the size in the above statement, I read the stream and find the length.
Because of this I am getting the following error message and the data is not getting inserted:

Exception during insertion : Failed for MYTABLE Reason [Microsoft][SQLServer 2000 Driver for JDBC]Transliteration failed.

Is there any alternate method to handle this? Please help.Are you executing the statement within a loop? If that's the case, - see if this will help:

http://knowledgebase2.datadirect.com/kbase.nsf/SupportLink+Online/2471321MF?OpenDocument