Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 19 Oct 2005 @ 17:04:38 GMT

  <Prev Next>  
Next> Last>>  

Subj:   JDBC exception for double byte characters
From:   Parikh, Vivek

Hello All,

We have a need to transfer data from Oracle database with multi-byte characters (e.g Russian) into Teradata table.

In our java code, we are getting the following exception when try to set multi-byte characters in the callableStatement and execute it:

com.ncr.teradata.jdbc_4.util.JDBCException: [NCR] [Teradata DBMS] : The string contains an untranslatable character.


     code excerpt

     import java.sql.*;
     // Create the callableStatement to invoke the Teradata Macro. The
     question mark stands for the input parameter for the macro.
     CallableStatement cst = teraConn.prepareCall("{exec
     //  get the sales person name from Contrac object. The value here
     contains Russian characters (double-byte): ??????. And the str value in
     reader showed the correct value in runtime when running in debugger.

     StringReader reader = new StringReader(contract.getSalesPerson());
     // get the number of characters in the string, which is 6 in this case.
     we also tried to use getBytes("UTF-8") to get the number of bytes, which
     is 12. We got the same exception with both methods.
     int len = contract.getSalesPersonCode().getBytes().length;
     cst.setCharacterStream(1, reader, len);


If the salePserson field value contains all single-byte characters (eg French), we would be fine. If it contains any multi-byte characters, we would get the above exception.

We use Teradata Driver for JDBC version We have two jar files included in our project: tdgssjava.jar and terajdbc4.jar. Teradata version is V2R5.1

Could anyone explain why we would be getting these errors?


Vivek Parikh

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020