title: How can I get pyodbc to return correct values from an old MS Access database
body: <p>I am running 64-bit Ubuntu 11.0, 64 bit python 2.7.2, and pyodbc 3.0.3.</p>
  
  <p>I am trying to retrieve data from an old access database (I think it's 97 but not 100% sure) residing on a network windows machine.</p>
  
  <p>I run the following select, and the results are shown:</p>
  
  <pre><code>select id, firstname, lastname from customer where id &lt; 5
  </code></pre>
  
  <p><em>(id is of type  "Counter" and firstname and lastname are varchar)</em></p>
  
  <p><strong>From python, pyodbc on Ubuntu (something wrong here)</strong>:</p>
  
  <pre><code>(16973874, 'Candance\x00\x00', 'Mattingly\x00\x00')
  (16973875, 'Anthony &amp; Ana Marie\x00\x00', 'Cushing\x00&amp;')
  (16973876, 'Sharon\x00\x00', 'Brown\x00\x00')
  </code></pre>
  
  <p><strong>From isql on Ubuntu (good results) (reformatted slightly)</strong>:</p>
  
  <pre><code>| 2 | Candance             | Mattingly  |
  | 3 | Anthony &amp; Ana Marie  | Cushing    |
  | 4 | Sharon               | Brown      
  </code></pre>
  
  <p><strong>From python, pyodbc on Windows 7, 64bit (good results)</strong>:</p>
  
  <pre><code>(2, u'Candance', u'Mattingly')
  (3, u'Anthony &amp; Ana Marie', u'Cushing')
  (4, u'Sharon', u'Brown')
  </code></pre>
  
  <hr>
  
  <p>My odbc.ini looks similar to this:</p>
  
  <pre><code>[MSACCESS]
  Description             = Old MS Access Database 
  Driver                  = /usr/lib/libmdbodbc.so.0
  Database                = [path to mounted drive].mdb
  </code></pre>
  
  <p><em><strong>Basically, pyodbc is returning incorrect results (or interpreting them incorrectly) on Ubuntu. I'd appreciate any helpful suggestions to fix this.</em></strong></p>
  
  <ul>
  <li>I've tried many variations of adding "client charset = XXX", but they didn't seem to have any effect.</li>
  <li>note that from pyodbc on Ubuntu, the "id" column being returned is 16973872 too high, and the varchar columns seem to end in semi-random bytes (many are not \x00)</li>
  </ul>