JezK
Edit File: uodbc.html
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ODBC on Unix</title><link rel="stylesheet" type="text/css" href="userguide.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="home" href="index.html" title="FreeTDS User Guide" /><link rel="up" href="software.html" title="Chapter 7. How to get what works with it working" /><link rel="prev" href="qt.html" title="Qt" /><link rel="next" href="troubleshooting.html" title="Chapter 8. Troubleshooting" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ODBC on Unix</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="qt.html">Prev</a> </td><th width="60%" align="center">Chapter 7. How to get what works with it working</th><td width="20%" align="right"> <a accesskey="n" href="troubleshooting.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="uodbc"></a>ODBC on Unix</h2></div></div></div><p><code class="systemitem">ODBC</code> has some issues on Unix, mainly due to lack of clean specifications.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="uodbc.64"></a>ODBC and 64-bit</h3></div></div></div><p>ODBC was originally specified as 32-bit<a href="#ftn.idm3140" class="footnote" id="idm3140"><sup class="footnote">[23]</sup></a>. Its evolution to 64-bit took place in the absence of a good specification which led to conflicting declarations and associated problems. For instance, some parameters are defined as SQLINTEGER but are used for pointer offsets. But SQLINTEGER was (and remains) 32-bit, while pointer offsets must be 64-bit. Also row numbers and some other formerly 32-bit quantities are now 64-bit.</p><p>If you use <code class="systemitem">unixODBC</code> Frediano would recommend at least version 2.2.14. Earlier versions have issues if used on 64-bit environments.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="uodbc.wchar"></a>sizeof(SQLWCHAR)</h3></div></div></div><p>Under Windows <code class="literal">sizeof(wchar_t) == sizeof(SQLWCHAR) == 2</code> but on many Unix systems you have <code class="literal">sizeof(wchar_t) == 4</code>. And some DMs decided to keep <code class="literal">sizeof(SQLWCHAR) == 2</code> (including <code class="systemitem">unixODBC</code>) while in other DM <code class="literal">sizeof(SQLWCHAR) == sizeof(wchar_t) == 4</code> (namely <code class="systemitem">iODBC</code>). This leads to incompatible ABIs between applications and drivers. If you compile the <span class="productname">FreeTDS</span> ODBC driver using <code class="systemitem">iODBC</code> take care to ensure all drivers are compiled with the same header files.</p><p>Alternatively, compile <span class="productname">FreeTDS</span> with both includes and rename the library to use two ABIs (for instance having a <code class="filename">libtdsiodbc.so</code> and a <code class="filename">libtdsuodbc.so</code>).</p><p>At the time of writing <span class="productname">Ubuntu</span> compiled Qt using <code class="systemitem">iODBC</code> but most packages use <code class="systemitem">unixODBC</code>. If you plan to use Qt with the <span class="productname">FreeTDS</span> <code class="systemitem">ODBC</code> driver, you should have an <code class="systemitem">iODBC</code>-compatible driver. Also be aware that the QODBC Qt driver has problems with <code class="systemitem">iODBC</code> and <code class="literal">SQLWCHAR</code> (see <a class="link" href="qt.html" title="Qt">Qt</a>). Due to these problems Frediano suggests not using this configuration (Qt database) on <span class="productname">Ubuntu</span> at this time.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="uodbc.char"></a>Default charset</h3></div></div></div><p>Character encoding is yet another trap. ODBC makes no provision for specifying client character encoding. By default many DM converting from multi-byte to wide characters assume the client uses ISO 8859-1. Even the <span class="productname">FreeTDS</span> driver assumes ISO 8859-1 by default. Also some DM have problems converting multi-byte encodings (like UTF-8), by assuming a byte can be converted to a single wide character (and vice versa). That creates problems if you use multi-byte encoding for <span class="productname">FreeTDS</span> driver.</p></div><div class="footnotes"><br /><hr style="width:100; text-align:left;margin-left: 0" /><div id="ftn.idm3140" class="footnote"><p><a href="#idm3140" class="para"><sup class="para">[23] </sup></a>In fact, the earliest versions were 16-bit.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="qt.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="software.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="troubleshooting.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Qt </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. Troubleshooting</td></tr></table></div></body></html>