skip to main content
Configuring Hybrid Data Pipeline Driver for ODBC : Internationalization, localization, and Unicode : Unicode ODBC Drivers : Default Unicode mapping : Connection Attribute for Unicode
  

Try Now
Connection Attribute for Unicode
If you do not want to use the default Unicode mappings for SQL_C_WCHAR, a connection attribute is available to override the default mappings. This attribute determines how character data is converted and presented to an application and the database.
Attribute
Description
SQL_ATTR_APP_WCHAR_TYPE (1061)
Sets the SQL_C_WCHAR type for parameter and column binding to the Unicode type, either SQL_DD_CP_UTF16 (default for Windows) or SQL_DD_CP_UTF8 (default for UNIX/Linux).
You can set this attribute before or after you connect. After this attribute is set, all conversions are made based on the character set specified.
For example:

rc = SQLSetConnectAttr (hdbc, SQL_ATTR_APP_WCHAR_TYPE, (void *)SQL_DD_CP_UTF16, SQL_IS_INTEGER);
SQLGetConnectAttr and SQLSetConnectAttr for the SQL_ATTR_APP_WCHAR_TYPE attribute return a SQL State of HYC00 for drivers that do not support Unicode.
This connection attribute and its valid values can be found in the file qesqlext.h, which is installed with the product.