Retrieve and display unicode data using ADO and DB2 V7.2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daman

    Retrieve and display unicode data using ADO and DB2 V7.2

    Hi,

    I am currently facing difficulty displaying chinese, japanese, russian
    etc. characters. I am using VB 6 and ADO to query the DB2 Version 7.2
    unicode database (UTF-8). The resultset that comes back contains
    garbage characters for Chinese, Russian etc languages. The english
    characters come back fine using ADO.

    It seems that DB2 assumes that my application is NOT Unicode
    compliant.

    How can I make my application unicode compliant so that MSDASQL.1
    makes all the right calls to DB2CLI?
    I have tried using IBMDADB2 driver as well but the problem is still
    there.

    I have tried these things:
    1) Setting the DB2CODEPAGE instance variable to 1208.
    CLI trace shows that Applicaition code page = 1208 and DB2 Code page =
    1208
    I would have thought that DB2CLI will not do the code page conversion
    as both the application and DB2 code pages are the same.

    However, reading the CLI trace carefully revealed that DB2 is binding
    the query columns using SQL_C_CHAR instead of SQL_C_WCHAR. According
    to the DB2 documentation, for UNICODE applications, DB2 will
    automatically bind columns using SQL_C_WHAR, thus preventing any data
    loss.

    I am completly stuck as to how to make my VB application a "UNICODE"
    application so that I can retrieve the data in its UNICODE format and
    not in ASCII format. My initial hunch is that DB2 is converting the
    data to ANSII while fetching the information from the database. The
    resultset that comes back to me is in ASCII format. How can I prevent
    this?

    I have opened a ticket with IBM but they don't have an answer for me
    yet.

    Any help is appreciated.

    Any ideas!!!

    Thanks.

    --Daman
  • Mark Yudkin

    #2
    Re: Retrieve and display unicode data using ADO and DB2 V7.2

    VB6 automatically converts from its internal unicode representation to ASCII
    for all external functions, thus DB2 is being told by VB6 to use ASCII even
    when you try to access unicode data. This is a VB6 limitation, not a DB2
    issue, and there is no official "workaround " as it is part of the VB6
    design.

    "Daman" <damanm2003@yah oo.ca> wrote in message
    news:f41b131b.0 312120734.5fca5 bfc@posting.goo gle.com...[color=blue]
    > Hi,
    >
    > I am currently facing difficulty displaying chinese, japanese, russian
    > etc. characters. I am using VB 6 and ADO to query the DB2 Version 7.2
    > unicode database (UTF-8). The resultset that comes back contains
    > garbage characters for Chinese, Russian etc languages. The english
    > characters come back fine using ADO.
    >
    > It seems that DB2 assumes that my application is NOT Unicode
    > compliant.
    >
    > How can I make my application unicode compliant so that MSDASQL.1
    > makes all the right calls to DB2CLI?
    > I have tried using IBMDADB2 driver as well but the problem is still
    > there.
    >
    > I have tried these things:
    > 1) Setting the DB2CODEPAGE instance variable to 1208.
    > CLI trace shows that Applicaition code page = 1208 and DB2 Code page =
    > 1208
    > I would have thought that DB2CLI will not do the code page conversion
    > as both the application and DB2 code pages are the same.
    >
    > However, reading the CLI trace carefully revealed that DB2 is binding
    > the query columns using SQL_C_CHAR instead of SQL_C_WCHAR. According
    > to the DB2 documentation, for UNICODE applications, DB2 will
    > automatically bind columns using SQL_C_WHAR, thus preventing any data
    > loss.
    >
    > I am completly stuck as to how to make my VB application a "UNICODE"
    > application so that I can retrieve the data in its UNICODE format and
    > not in ASCII format. My initial hunch is that DB2 is converting the
    > data to ANSII while fetching the information from the database. The
    > resultset that comes back to me is in ASCII format. How can I prevent
    > this?
    >
    > I have opened a ticket with IBM but they don't have an answer for me
    > yet.
    >
    > Any help is appreciated.
    >
    > Any ideas!!!
    >
    > Thanks.
    >
    > --Daman[/color]


    Comment

    Working...