title: Can't connect to SQL Server DB from Pyodbc
body: <p>I am having a difficult time trying to connect to a SQL Server DB on Linux, using pyodbc.  I have a ODCINI file entry created.  I started with this:</p>
  
  <pre><code>import pyodbc
  
  conn = pyodbc.connect('DSN=DSN;Database=DB;UID=UID;PWD=PWD')
  
  cursor = conn.cursor()
  cursor.execute('SELECT count(*) FROM dbo.tableA')
  for row in cursor.fetchall():
      print(row)
  </code></pre>
  
  <p>which throws this error:</p>
  
  <pre><code>RuntimeError: Unable to set SQL_ATTR_CONNECTION_POOLING attribute.
  </code></pre>
  
  <p>I googled that error and added this line after reading some recommendations:</p>
  
  <pre><code>pyodbc.pooling=False
  </code></pre>
  
  <p>So script changed to this:</p>
  
  <pre><code>import pyodbc
  
  pyodbc.pooling=False
  
  conn = pyodbc.connect('DSN=DSN;Database=DB;UID=UID;PWD=PWD')
  
  cursor = conn.cursor()
  cursor.execute('SELECT count(*) FROM dbo.tableA')
  for row in cursor.fetchall():
      print(row)
  </code></pre>
  
  <p>Which resulted in this:</p>
  
  <pre><code>pyodbc.InterfaceError: ('IM003', '[IM003] 䑛瑡䑡物捥嵴佛䉄⁃楬嵢匠数楣楦摥搠楲敶\u2072潣汵\u2064潮⁴敢氠慯敤d\uffff\uffff㢸ꔻ罱\x00\ue5b8鮫罱\x00㳰ꔻ罱\x00\uffff\uffff罱\x00\x00\x00\x00\x00鳭ꕞ罱\x00塰ꕉ罱 (0) (SQLDriverConnect)')
  </code></pre>
  
  <p>At the suggestion of a coworker I added these 2 lines AFTER the pyodbc.connect line:</p>
  
  <pre><code>conn.setdecoding(pyodbc.SQL_CHAR, encoding='latin1', to=str)
  conn.setencoding(str, encoding='latin1')
  </code></pre>
  
  <p>I tried that with both latin1 and utf-8.  Neither work, still throws the same interface error with Chinese characters.  </p>
  
  <p>Any ideas?</p>