KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q293653: BUG: Access ODBC Driver Incorrectly Maps Unicode Datatypes

Article: Q293653
Product(s): Open Database Connectivity (ODBC)
Version(s): 4.0
Operating System(s): 
Keyword(s): kbDatabase kbODBC kbGrpDSVCDB kbDSupport
Last Modified: 08-APR-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft ODBC Driver for Access, version 4.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

Client applications that call the ODBC API SQLBindCol() function to bind a
Unicode data column using SQL_C_DEFAULT will be bound as SQL_C_CHAR. In
addition, calling the ODBC API SQLDescribeCol() function on the same column will
return the column's datatype as SQL_VARCHAR.

CAUSE
=====

The Microsoft Access ODBC driver intentionally maps these Unicode datatypes to
protect older applications that have been written to use SQL_C_DEFAULT. Mapping
columns bound with SQL_C_DEFAULT to Unicode datatypes of SQL_WCHAR,
SQL_WVARCHAR, or SQL_LONGVARCHAR could potentially break older applications.

RESOLUTION
==========

Applications that require access to extended characters should not bind the
Unicode datatype columns as SQL_C_DEFAULT. Instead, these programs should bind
Unicode columns as SQL_WCHAR, SQL_WVARCHAR, or SQL_LONGVARCHAR in order to avoid
this behavior in the Microsoft Access ODBC driver.

STATUS
======

Microsoft has confirmed this to be a bug in the Microsoft products listed at the
beginning of this article.

MORE INFORMATION
================

Please note that the "Text" and "Memo" columns in Microsoft Access version 4.0
databases are Unicode data fields.

This behavior is not an issue with .mdb files prior to version 4.0.

REFERENCES
==========

ODBC API Programmer's Reference, MSDN, Platform SDK Documentation.


Additional query words: Unicode, ODBC, SQLBindCol

======================================================================
Keywords          : kbDatabase kbODBC kbGrpDSVCDB kbDSupport 
Technology        : kbAudDeveloper kbAccessSearch kbODBCSearch kbODBCAccess400
Version           : :4.0
Issue type        : kbbug

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.