Sunday 15 August 2010

delphi - Reading Unicode data from DB2 via ADO and ODBC -


With my application written with the Delphi 2009, I am reading and writing from the IBM DB2 database for the ADO, ODBC provider. ADO, and ODBC: ADO (Win32) -> ODBC Provider for ADO -> ODBC -> (Net) -> DB2 (Windows)

Now, my Unicode data needs to be stored So I set my database codepace in UTF-8 Delphi internally handles the string in UTF-16 and sends them as multi-byte-character for com. Therefore, I should be right on the encoding of the application.

Entering non-ansi-characters in a VARCHAR DB area works fine, they are displayed properly by the DB2 management console (which is a Java application using, I thought, JDBC) . In my application (or any other test application I have written that ADO uses questions), I get the sequence of # $ 1 bytes for the VARCHAR field only with the Unicode characters in them. Strangely, the same application works fine if the backend is a Microsoft SQL database. Retrieving ANSI-compliant character strings is also not a problem for DB2.

In the DB2 document it says that the DB2 ODBC driver responds with Unicode characters if an application suffix -d says the ODBC API, is it possible that in some circumstances the ODBC provider for the ADO Does not trigger tasks, but instead uses ANSI function? I tried to successfully set up a client codepost in the ADO Connection String and ODBC Driver Settings, although I could have done wrong wav.

I had a similar problem. I've added DISABLEUNICODE = 0 to my connection string and resolved it for me.


No comments:

Post a Comment