Incorrect characters returned in UTF8 session

Connectivity
N/A

Incorrect characters returned in UTF8 session

When using JDBC to retrieve characters from a char column in UTF8 charset session, we get a character string of double the size of the column length. Does anyone know why and how to workaound it?

For example:

1. connect to the database in UTF8 session
jdbc:teradata://td/CHARSET=UTF8

2. create table and insert data
CREATE TABLE employee (empName CHAR(10));
INSERT INTO empolyee values('a');

3. SELECT empName from employee
The length of empName is 20. (Wrong!)

4. connect to the database in default charset session
jdbc:teradata://td

5. SELECT empName from employee
The length of empName is 10. (Correct!)

I'm using JDBC Driver 12.0.0.1 and the database is V2R6.

1 REPLY
Teradata Employee

Re: Incorrect characters returned in UTF8 session

That is expected behavior due to the Teradata Database's Export Width feature. More information is available in the Teradata JDBC Driver Reference.

http://developer.teradata.com/doc/connectivity/jdbc/reference/current/jdbcug_chapter_5.html#BGBJECGD