Edit C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\7.0.1\help\reference\unicode.06.4.html
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <!-- MOTW-DISABLED saved from url=(0014)about:internet --> <title>Unicode and Non-Unicode ODBC Drivers</title> <link rel="StyleSheet" href="css/unicode.css" type="text/css" media="all" /> <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" /> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/context.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/towwhdir.js"></script> <script type="text/javascript" language="JavaScript1.2" src="wwhdata/common/wwhpagef.js"></script> <script type="text/javascript" language="JavaScript1.2"> <!-- var WebWorksRootPath = ""; // --> </script> <script type="text/javascript" language="JavaScript1.2"> <!-- // Set reference to top level help frame // var WWHFrame = WWHGetWWHFrame("", true); // --> </script> <script type="text/javascript" language="JavaScript1.2" src="scripts/expand.js"></script> </head> <body class="" style="background-color: #FFFFEE;" onload="WWHUpdate();" onunload="WWHUnload();" onkeydown="WWHHandleKeyDown((document.all||document.getElementById||document.layers)?event:null);" onkeypress="WWHHandleKeyPress((document.all||document.getElementById||document.layers)?event:null);" onkeyup="WWHHandleKeyUp((document.all||document.getElementById||document.layers)?event:null);"> <br /> <div class="WebWorks_Breadcrumbs" style="text-align: left;"> <a class="WebWorks_Breadcrumb_Link" href="unicode.06.1.html#106297">4 Internationalization, Localization, and Unicode</a> : Unicode and Non-Unicode ODBC Drivers</div> <hr align="left" /> <blockquote> <div class="head_1"><a name="106297">Unicode and Non-Unicode ODBC Drivers</a></div> <div class="Body"><a name="106298">The way in which a driver handles function calls from a Unicode application determines </a>whether it is considered a "Unicode driver."</div> <div class="head_2"><a name="106300">Function Calls</a></div> <div class="Body"><a name="106301">Instead of the standard ANSI SQL function calls, such as SQLConnect, Unicode </a>applications use "W" (wide) function calls, such as SQLConnectW. If the driver is a true Unicode driver, it can understand "W" function calls and the Driver Manager can pass them through to the driver without conversion to ANSI. The DataDirect Connect Series <span class="forbody">for</span> <span class="APIbody">ODBC</span> drivers that support "W" function calls are:</div> <div class="list_bulleted_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_inner"><a name="107906">DB2 Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107907">Greenplum Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107909">MySQL Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107910">Oracle Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="112276">Oracle</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107911">PostgreSQL Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="112072">Progress OpenEdge Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="112290">Salesforce</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107912">SQL Server Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="112304">SQL Server Legacy Wire Protocol (UNIX only)</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107913">Sybase Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="111945">Sybase IQ Wire Protocol</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107924">Teradata</a></div> </td> </tr> </table> </div> <div class="list_bulleted_single_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_bulleted_single_inner" style="width: 18pt; white-space: nowrap;">â? </div> </td> <td width="100%"> <div class="list_bulleted_single_inner"><a name="107925">XML</a></div> </td> </tr> </table> </div> <div class="Body"><a name="106309">If the driver is a non-Unicode driver, it cannot understand W</a> function calls, and the Driver Manager must convert them to ANSI calls before sending them to the driver. The Driver Manager determines the ANSI encoding system to which it must convert by referring to a code page. On Windows, this reference is to the Active Code Page. On UNIX and Linux, it is to the IANAAppCodePage connection string attribute, part of the odbc.ini file.</div> <div class="Body"><a name="106310">The following examples illustrate these conversion streams for </a>the DataDirect Connect Series <span class="forbody">for</span> <span class="APIbody">ODBC</span> drivers. The Driver Manager on UNIX and Linux prior to the DataDirect Connect Series <span class="forbody">for</span> <span class="APIbody">ODBC</span> Release 5.0 assumes that Unicode applications and Unicode drivers use the same encoding (UTF-8). For the DataDirect Connect Series <span class="forbody">for</span> <span class="APIbody">ODBC</span> Release 5.0 and higher on UNIX and Linux, the Driver Manager determines the type of Unicode encoding of both the application and the driver, and performs conversions when the application and driver use different types of encoding. This determination is made by checking two ODBC environment attributes: SQL_ATTR_APP_UNICODE_TYPE and SQL_ATTR_DRIVER_UNICODE_TYPE. <span class="Cross_ref_"><a href="javascript:WWHClickedPopup('reference', 'unicode.06.5.html#106446', '');">â??Driver Manager and Unicode Encoding on UNIX/Linuxâ??</a></span> describes in detail how this is done.</div> <div class="head_3"><a name="106314">Unicode Application with a Non-Unicode Driver </a></div> <div class="Body"><a name="106315">An operation involving a Unicode application and a non-Unicode driver incurs more </a>overhead because function conversion is involved.</div> <div class="head_4"><a name="106319">Windows</a></div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106320">The Unicode application sends UCS-2/UTF-16 function calls to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106321">The Driver Manager converts the function calls from UCS</a>â??2/UTF-16 to ANSI. The type of ANSI is determined by the Driver Manager through reference to the client machineâ??s Active Code Page.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106322">The Driver Manager sends the ANSI function calls to the non-Unicode driver.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106323">The driver returns ANSI argument values to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">5 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106716">The Driver Manager converts the function calls from ANSI to UCS-2/UTF-16 and </a>returns these converted calls to the application.</div> </td> </tr> </table> </div> <div class="head_4"><a name="106720">UNIX and Linux: DataDirect Connect</a><span class="superscript">®</span> Series <span class="Emphasis">for</span> ODBC Releases Prior to 5.0</div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106329">The Unicode application sends UTF-8 function calls to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106330"> </a> The Driver Manager converts the function calls from UTF-8 to ANSI. The type of ANSI is determined by the Driver Manager through reference to the client machineâ??s value for the IANAAppCodePage connection string attribute.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106331"> </a>The Driver Manager sends the converted ANSI function calls to the non-Unicode driver.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106332">The driver returns ANSI argument values to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">5 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106333"> </a> The Driver Manager converts the function calls from ANSI to UTF-8 and returns these converted calls to the application.</div> </td> </tr> </table> </div> <div class="head_4"><a name="106337">UNIX and Linux: DataDirect Connect</a><span class="superscript">®</span> Series <span class="Emphasis">for</span> ODBC 5.0 and Higher</div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106338">The Unicode application sends function calls to the Driver Manager. The Driver </a>Manager expects these function calls to be UTF-8 or UTF-16 based on the value of the SQL_ATTR_APP_UNICODE_TYPE attribute.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106339">The Driver Manager converts the function calls from UTF-8 or UTF-16 to ANSI. The </a>type of ANSI is determined by the Driver Manager through reference to the client machineâ??s value for the IANAAppCodePage connection string attribute.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106340">The Driver Manager sends the converted ANSI function calls to the non-Unicode driver.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106341">The driver returns ANSI argument values to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">5 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106342"> </a> The Driver Manager converts the function calls from ANSI to UTF-8 or UTF-16 and returns these converted calls to the application.</div> </td> </tr> </table> </div> <div class="head_3"><a name="106343">Unicode Application with a Unicode Driver</a></div> <div class="Body"><a name="106344">An operation involving a Unicode application and a Unicode driver that use the same </a>Unicode encoding is efficient because no function conversion is involved. If the application and the driver each use different types of encoding, there is some conversion overhead. See <span class="Cross_ref_"><a href="javascript:WWHClickedPopup('reference', 'unicode.06.5.html#106446', '');">â??Driver Manager and Unicode Encoding on UNIX/Linuxâ??</a></span> for details.</div> <div class="head_4"><a name="106351">Windows</a></div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106352">The Unicode application sends UCS-2 or UTF-16 function calls to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106353">The Driver Manager does not have to convert the UCS</a>â??2/UTFâ??16 function calls to ANSI. It passes the Unicode function call to the Unicode driver.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106354">The driver returns UCS-2/UTF-16 argument values to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106355">The Driver Manager returns UCS-2/UTF-16 function calls to the application.</a></div> </td> </tr> </table> </div> <div class="head_4"><a name="106359">UNIX and Linux: DataDirect Connect</a><span class="superscript">®</span> Series <span class="Emphasis">for</span> ODBC Releases Prior to 5.0</div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106360">The Unicode application sends UTF-8 function calls to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106361">The Driver Manager does not have to convert the UTF-8 function calls to ANSI. It </a>passes the Unicode function call with UTF-8 arguments to the Unicode driver.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106362">The driver returns UTF-8 argument values to the Driver Manager.</a></div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106363"> </a> The Driver Manager returns UTF-8 function calls to the application.</div> </td> </tr> </table> </div> <div class="head_4"><a name="106367">UNIX and Linux: DataDirect Connect</a><span class="superscript">®</span> Series <span style="font-size: 11.0pt;">for ODBC</span> 5.0 and Higher</div> <div class="list_procedure_first_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_first_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">1 </span> </div> </td> <td width="100%"> <div class="list_procedure_first_inner"><a name="106368">The Unicode application sends function calls to the Driver Manager. The Driver </a>Manager expects these function calls to be UTF-8 or UTF-16 based on the value of the SQL_ATTR_APP_UNICODE_TYPE attribute.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">2 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106369"> </a> The Driver Manager passes Unicode function calls to the Unicode driver. The Driver Manager has to perform function call conversions if the SQL_ATTR_APP_UNICODE_TYPE is different from the SQL_ATTR_DRIVER_UNICODE_TYPE.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">3 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106370">The driver returns argument values to the Driver Manager. Whether these are UTF-8 or </a>UTF-16 argument values is based on the value of the SQL_ATTR_DRIVER_UNICODE_TYPE attribute.</div> </td> </tr> </table> </div> <div class="list_procedure_outer" style="margin-left: 0pt;"> <table border="0" cellspacing="0" cellpadding="0" summary=""> <tr style="vertical-align: baseline;"> <td> <div class="list_procedure_inner" style="width: 18pt; white-space: nowrap;"> <span class="Numbers">4 </span> </div> </td> <td width="100%"> <div class="list_procedure_inner"><a name="106371"> </a> The Driver Manager returns appropriate function calls to the application based on the SQL_ATTR_APP_UNICODE_TYPE attribute value. The Driver Manager has to perform function call conversions if the SQL_ATTR_DRIVER_UNICODE_TYPE value is different from the SQL_ATTR_APP_UNICODE_TYPE value.</div> </td> </tr> </table> </div> <div class="head_2"><a name="106372">Data</a></div> <div class="Body"><a name="106373">ODBC C data types are used to indicate the type of C buffers that store data in the </a>application. This is in contrast to SQL data types, which are mapped to native database types to store data in a database (data store). ANSI applications bind to the C data type SQL_C_CHAR and expect to receive information bound in the same way. Similarly, most Unicode applications bind to the C data type SQL_C_WCHAR (wide data type) and expect to receive information bound in the same way. Any ODBC 3.5-compliant Unicode driver must be capable of supporting SQL_C_CHAR and SQL_C_WCHAR so that it can return data to both ANSI and Unicode applications.</div> <div class="Body"><a name="106374">When the driver communicates with the database, it must use ODBC SQL data types, such </a>as SQL_CHAR and SQL_WCHAR, that map to native database types. In the case of ANSI data and an ANSI database, the driver receives data bound to SQL_C_CHAR and passes it to the database as SQL_CHAR. The same is true of SQL_C_WCHAR and SQL_WCHAR in the case of Unicode data and a Unicode database.</div> <div class="Body"><a name="106375">When data from the application and the data stored in the database differ in format, for </a>example, ANSI application data and Unicode database data, conversions must be performed. The driver cannot receive SQL_C_CHAR data and pass it to a Unicode database that expects to receive a SQL_WCHAR data type. The driver or the Driver Manager must be capable of converting SQL_C_CHAR to SQL_WCHAR, and vice versa.</div> <div class="Body"><a name="106376">The simplest cases of data communication are when the application, the driver, and the </a>database are all of the same type and encoding, ANSI-to-ANSI-to-ANSI or Unicode-to-Unicode-to-Unicode. There is no data conversion involved in these instances.</div> <div class="Body"><a name="106377">When a difference exists between data types, a conversion from one type to another must </a>take place at the driver or Driver Manager level, which involves additional overhead. The type of driver determines whether these conversions are performed by the driver or the Driver Manager. <span class="Cross_ref_"><a href="javascript:WWHClickedPopup('reference', 'unicode.06.5.html#106446', '');">â??Driver Manager and Unicode Encoding on UNIX/Linuxâ??</a></span> describes how the Driver Manager determines the type of Unicode encoding of the application and driver.</div> <div class="Body"><a name="106383">The following sections discuss two basic types of data conversion in </a>the DataDirect Connect Series <span class="forbody">for</span> <span class="APIbody">ODBC</span> drivers and the Driver Manager. How an individual driver exchanges different types of data with a particular database at the database level is beyond the scope of this discussion.</div> <div class="head_3"><a name="106384">Unicode Driver</a></div> <div class="Body"><a name="106385">The Unicode driver, not the Driver Manager, must convert SQL_C_CHAR (ANSI) data to </a>SQL_WCHAR (Unicode) data, and vice versa, as well as SQL_C_WCHAR (Unicode) data to SQL_CHAR (ANSI) data, and vice versa.</div> <div class="Body"><a name="106386">The driver must use client code page information (Active Code Page on Windows and </a>IANAAppCodePage attribute on UNIX/Linux) to determine which ANSI code page to use for the conversions. The Active Code Page or IANAAppCodePage must match the database default character encoding; if it does not, conversion errors are possible.</div> <div class="head_3"><a name="106387">ANSI Driver</a></div> <div class="Body"><a name="106388">The Driver Manager, not the ANSI driver, must convert SQL_C_WCHAR (Unicode) data to </a>SQL_CHAR (ANSI) data, and vice versa (see <span class="Cross_ref_"><a href="javascript:WWHClickedPopup('reference', 'unicode.06.3.html#106286', '');">â??Unicode Support in ODBCâ??</a></span> for a detailed discussion). This is necessary because ANSI drivers do not support any Unicode ODBC types.</div> <div class="Body"><a name="106392">The Driver Manager must use client code page information (Active Code Page on Windows </a>and the IANAAppCodePage attribute on UNIX/Linux) to determine which ANSI code page to use for the conversions. The Active Code Page or IANAAppCodePage must match the database default character encoding. If not, conversion errors are possible.</div> <div class="head_2"><a name="106395">Default Unicode Mapping</a></div> <div class="Body"><a name="106396">The default Unicode mapping for an applicationâ??s SQL_C_WCHAR variable is:</a></div> <table class="Format_B" cellspacing="0" summary=""> <caption></caption> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_column_heads"><a name="106399">Platform</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_column_heads"><a name="106401">Default Unicode Mapping</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106403">Windows</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106405">UCS-2/UTF-16</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106407">AIX</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106409">UTF-8</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106411">HP-UX</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106413">UTF-8</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106415">Solaris</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106417">UTF-8</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106419">Linux</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106421">UTF-8</a></div> </td> </tr> </table> <div class="head_3"><a name="106427">Connection Attribute for Unicode</a></div> <div class="Body"><a name="106428">If you do not want to use the default Unicode mappings for SQL_C_WCHAR, a connection </a>attribute is available to override the default mappings. This attribute determines how character data is converted and presented to an application and the database.</div> <table class="Format_B" cellspacing="0" summary=""> <caption></caption> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_column_heads"><a name="106431">Attribute</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_column_heads"><a name="106433">Description</a></div> </td> </tr> <tr style="vertical-align: top;"> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106435">SQL_ATTR_APP_WCHAR_TYPE (1061)</a></div> </td> <td style="padding-bottom: auto; padding-left: auto; padding-right: auto; padding-top: auto; vertical-align: top;"> <div class="table_text"><a name="106437">Sets the SQL_C_WCHAR type for </a>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).</div> </td> </tr> </table> <div class="Body"><a name="106439">You can set this attribute before or after you connect. After this attribute is set, all </a>conversions are made based on the character set specified.</div> <div class="Body"><a name="106440">For example:</a></div> <div class="syntax_first"><a name="106441">rc = SQLSetConnectAttr (hdbc, SQL_ATTR_APP_WCHAR_TYPE, (void *)SQL_DD_CP_UTF16, </a>SQL_IS_INTEGER); </div> <div class="Body"><a name="106442">SQLGetConnectAttr and SQLSetConnectAttr for the SQL_ATTR_APP_WCHAR_TYPE </a>attribute return a SQL State of HYC00 for drivers that do not support Unicode.</div> <div class="Body"><a name="106443">This connection attribute and its valid values can be found in the file qesqlext.h, which is </a>installed with the product.</div> <div class="Body"><a name="106444">NOTE: For the SQL Server Legacy Wire Protocol driver, this attribute is supported only on </a>UNIX and Linux, not on Windows.</div> <script type="text/javascript" language="JavaScript1.2"> <!-- // Clear related topics // WWHClearRelatedTopics(); document.writeln(WWHRelatedTopicsInlineHTML()); // --> </script> </blockquote> <script type="text/javascript" language="JavaScript1.2"> <!-- document.write(WWHRelatedTopicsDivTag() + WWHPopupDivTag() + WWHALinksDivTag()); // --> </script> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de