title: Having Troubles with UnixODBC, FreeTDS, and PyODBC
body: <p>I am having great difficulty getting all three of these to work together in harmony. I guess I'll list all the various configurations, along with the test code to see if a pair of fresh eyes can realize my stupidity.</p>
  
  <p>I'm running 12.04 Ubuntu Server and I'm trying to connect to a MSSQL Server 2008 and end up using it with PyODBC. </p>
  
  <p>However, when just putting in </p>
  
  <pre><code>tsql -S T2 -U Foo -P Bar
  </code></pre>
  
  <p>I get the </p>
  
  <pre><code>1&gt;
  2&gt;
  3&gt;
  4&gt;
  5&gt;
  6&gt;
  7&gt;
  8&gt;
  9&gt;
  10&gt;
  11&gt;
  </code></pre>
  
  <p>and etc.</p>
  
  <p>Anyway, if anyone would be able to help (and I would be eternally grateful if you can clear me of this haze), here are my current configurations.</p>
  
  <p>This is my /etc/odbc.ini</p>
  
  <pre><code>[ODBC Data Sources]
  odbcname     = MySQL
  T2           = MSSQL
  
  [odbcname]
  Driver       = /usr/lib/odbc/libmyodbc.so
  Description  = MyODBC 3.51 Driver DSN
  SERVER       = Foobar
  PORT         = 3306
  USER         = Foo
  Password     = Bar
  Database     = Foobar
  OPTION       = 3
  SOCKET       =
  
  [T2]
  Driver       = FreeTDS
  Description  = ODBC connection via FreeTDS
  SERVER       = FOOBAR
  PORT         = 1433
  USER         = Foo
  Password     = Bar
  Database     = Foobar
  OPTION       = 3
  SOCKET       =
  
  [Default]
  Driver       = /usr/local/lib/libmyodbc3.so
  Description  = MyODBC 3.51 Driver DSN
  SERVER       = FOOBAR
  PORT         = 3306
  USER         = foo
  Password     = bar
  Database     = FOOBAR
  OPTION       = 3
  SOCKET       =
  </code></pre>
  
  <p>The following is my /etc/odbcinst.ini</p>
  
  <pre><code>[FreeTDS]
  Description=FreeTDS Driver
  Driver=/usr/lib/odbc/libtdsodbc.so
  Setup=/usr/lib/odbc/libtdsS.so
  CPTimeout=
  CPReuse=
  FileUsage=1
  </code></pre>
  
  <p>The following is my freetds.conf</p>
  
  <pre><code># This file is installed by FreeTDS if no file by the same
  # name is found in the installation directory.
  #
  # For information about the layout of this file and its settings,
  # see the freetds.conf manpage "man freetds.conf".
  
  # Global settings are overridden by those in a database
  # server specific section
  [global]
          # TDS protocol version
  ;       tds version = 4.2
  
          # Whether to write a TDSDUMP file for diagnostic purposes
          # (setting this to /tmp is insecure on a multi-user system)
  ;       dump file = /tmp/freetds.log
  ;       debug flags = 0xffff
  
          # Command and connection timeouts
  ;       timeout = 10
  ;       connect timeout = 10
  
          # If you get out-of-memory errors, it may mean that your client
          # is trying to allocate a huge buffer for a TEXT field.
          # Try setting 'text size' to a more reasonable limit
          #text size = 64512
  
  [T2]
          host = FOOBAR
          port = 1433
          tds version = 7.0
          client charset = UTF-8
          text size = 20971520
  [global]
          # TDS protocol version
          tds version = 7.0
  </code></pre>
  
  <p>And my Python test file just for good measure</p>
  
  <pre><code>import pyodbc
  import sys 
  
  try:
      #tempsystrends = pyodbc.connect('DRIVER=FreeTDS;SERVER=FOOBAR;PORT=1433;DATABASE=T2;UID=FOO;PWD=bar;TDS_Version=7.0;')
      cursor = tempsystrends.cursor()
  except pyodbc.Error as e:
          print "Error: %s" % (e.args[1])
          sys.exit(1)
  </code></pre>