Getting junk values for Latin column when using JDBC

Database

Getting junk values for Latin column when using JDBC

Hi,

I have a table with some LATIN column as following:

CREATE SET TABLE Data_Produkty ,NO FALLBACK ,

NO BEFORE JOURNAL,

NO AFTER JOURNAL,

CHECKSUM = DEFAULT,

DEFAULT MERGEBLOCKRATIO

(

Product_name VARCHAR CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,

IsActive CHAR CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL DEFAULT 'T',

Note VARCHAR CHARACTER SET LATIN NOT CASESPECIFIC,

AddDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(6),

AddUser VARCHAR CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL DEFAULT USER )

;

I'm using lastest JDBC driver with CHARSET=ASCII, TMODE=ANSI to connect to database but i'm getting junk values for LATIN columns ex.: Product_name, Note. The same error appears in Teradata Studio but I can see theses values properly in SQL Assistant.

What I can do ? Please help (I just use SELECT * FROM Data_Produkty)

3 REPLIES
Teradata Employee

Re: Getting junk values for Latin column when using JDBC

The "junk values" might be non-ASCII characters stored in your LATIN column, that cannot be represented with CHARSET=ASCII.

We recommend that you use CHARSET=UTF8 in order to ensure that all character values can be transferred successfully between the Teradata Database and the Teradata JDBC Driver.

Re: Getting junk values for Latin column when using JDBC

I tried without success, I received others "junk values", they are Polish character and I guess that, there must be solution for this

Teradata Employee

Re: Getting junk values for Latin column when using JDBC

If you are storing characters in a LATIN column that are actually supported by the Teradata Database for the server-side LATIN character set, then you will be able to retrieve those characters using CHARSET=UTF8 or CHARSET=UTF16.

On the other hand, if you are storing characters in a LATIN column that aren't supported by the Teradata Database for the server-side LATIN character set, then you will not be able to retrieve those characters in a supported manner. You can use the unsupported scheme of omitting the CHARSET connection parameter and specifying the unsupported CLIENT_CHARSET=JavaCharsetName connection parameter.

When you store non-LATIN characters into a LATIN column, the Teradata Database doesn't consider those to be the original non-LATIN characters; instead, the Teradata Database considers them to be Western European characters at those code points in the LATIN character set. Subsequently, those Western European characters won't compare properly against the same characters properly stored in a UNICODE column. Data corruption can occur, WHERE clause criteria won't work, and ORDER BY will misorder the character data.

We strongly recommend against storing non-LATIN characters in a LATIN column. We strongly recommend that customers use the Unicode Tool Kit to migrate their data into UNICODE columns.

We recognize that some customers do not follow our recommendations, and some customers engage in the unsupported activity of storing non-Western European characters in a LATIN column. To assist those customers, the Teradata JDBC Driver has an undocumented, unsupported connection parameter CLIENT_CHARSET, which exists for this situation of storing and retrieving characters from a LATIN column that the Teradata Database doesn't support in a LATIN column.

The CLIENT_CHARSET=JavaCharsetName connection parameter is an unsupported scheme for retrieving non-LATIN characters stored in a LATIN column. The customer uses the CLIENT_CHARSET connection parameter at their own risk. Data corruption will occur when using the CLIENT_CHARSET connection parameter, if the wrong JavaCharsetName is specified. Teradata cannot provide any guarantees of data fidelity or quality when the CLIENT_CHARSET connection parameter is used.