Inserting strings in UTF-8 Teradata using JDBC

Connectivity
N/A

Inserting strings in UTF-8 Teradata using JDBC

Hi,

How can insert UTF-8 bytes in Teradata in java using Teradata JDBC drivers?

When I try with setBytes(int index, bytes[]) method
I get Conversion bteween BYTE data and other types is illegal.

Any help?

Veso
2 REPLIES
N/A

Re: Inserting strings in UTF-8 Teradata using JDBC

Any idea?

getString() i setString() work fine, but setString() just for ASCII chars. For others (example for Central Europe code page) insert "?" in database. getString() read every chars normal.
Is it problem with JDBC drivers?

Any solution from Teradata support?

Thanks,
Veso
Teradata Employee

Re: Inserting strings in UTF-8 Teradata using JDBC

In order to use UTF8, you must specify the CHARSET=UTF8 connection parameter.

Then the Teradata JDBC Driver will handle all conversion from Java Strings into UTF8 encoding, before sending the data to the Teradata Database.

Do not bind character values using the setBytes method. Character values should be bound as Java Strings using the setString or setObject method.