ADO, ODBC, and Unicode

Connectivity
Enthusiast

ADO, ODBC, and Unicode

I'm using VBA and the Microsoft ActiveX Data Objects 2.6 Library to access our Teradata 14.00.05.03 server using Teradata ODBC Driver 15.00.00.01

I have a table that contains unicode characters. When I attempt to bring those back through the connection the unicode characters are converted to ansii and I end up with a bunch of arrows and question marks. I've defined CharacterSet=UTF16 in my connection string. I've tried different combinations of whatnot and have had no luck. No matter what I do ADO shoves the field into type adchar instead of the unicode compliant adwchar or advarwchar.

I would consider workarounds where, perhaps, I convert the varchar to binary in the SQL string, and then deconvert the binary into UTF16, but that's ugly and I'm not sure if Teradata is capable of converting unicode varchar to binary.

Tags (4)
1 REPLY
Enthusiast

Re: ADO, ODBC, and Unicode

Found the answer. Sticking it here for the next poor sap that spends 4 hours tearing their hair out. Unicode is fun.

In most of the documentation for the ODBC drivers for Teradata the property is listed as "CharacterSet=<charset>". When specifying the Character Set through ADO, at least for the ODBC 15.00.00.01 driver, the correct property is CharSet. The connection string must contains "CharSet=UTF16" in the extended properties in order to bring through unicode.