Differences between revisions 9 and 11 (spanning 2 versions)
Revision 9 as of 2013-11-26 23:39:05
Size: 3355
Revision 11 as of 2017-07-31 14:43:33
Size: 3421
Comment: Missing Database name in
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
(Starting Debian Wheezy 7.0+) (Starting Debian Wheezy,Jessie)
Line 57: Line 57:
Database = MyDatabase [replace with your database name]

Keywords: How to Install unixODBC,freeTDS on Debian Linux.


  • Install odbc, and mssql drivers (tdsodbc)

apt-get update
apt-get install tdsodbc unixodbc
  • Create a driver template.

vi /etc/freetds/tds.driver.template
  • Inside add :

(Starting Debian Wheezy,Jessie)

Description     = FreeTDS Driver for Linux & MSSQL on Win32
Driver          = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup           = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

Debian Wheezy 32bit

Description     = FreeTDS Driver for Linux & MSSQL on Win32
Driver          = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup           = /usr/lib/i386-linux-gnu/odbc/libtdsS.so

(Debian squeezy or prior)

Description     = FreeTDS Driver for Linux & MSSQL on Win32
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
  • Now dsn file:

vi /etc/freetds/tds.dsn.template
  • And inside add:

Description     = Descripton of you DSN connection.
Driver          = TDS
Trace           = No
Database        = DefaultDatabase [replace with your database name]
Server          = mysqlserver.inter.net [replace with your SQL server's host,ip]
Port            = 1433 [replace with the port that SQL is listening on]
TDS_Version     = 8.0
  • OR If you are using mssql with multiple instances and dynamic port allocation you can use the following:

Description     = Production Server
Driver          = TDS
Trace           = No
Server          = servername\instance_name
Database        = MyDatabase [replace with your database name]
TDS_Version     = 8.0
  • Now run this command to add your driver to unixodbc

odbcinst -i -d -f /etc/freetds/tds.driver.template
  • Now you add dsn. You have 2 options.
  • Add system DSN for all users

odbcinst -i -s -l -f /etc/freetds/tds.dsn.template
  • Add dsn to a user your are running a command on:

odbcinst -i -s -f /etc/freetds/tds.dsn.template
  • Now test your connection:

isql -v DSN_NAME username password
  • You should get something like

* unixODBC - isql                            *
* Syntax                                     *
*                                            *


  • If you can not connect it is probable that your database is listening on a different port.
  • Try this:

telnet myserver 1433

  • You should see something like:

Connected to myserver.
Escape character is '^]'.
  • type quit to exit. Replace 1433 with a port number, replace myserver with your servers name.

If you still get connection refused try telnet from the same machine the server is on and see if you get same answer.

freetds 64bit

  • If you get an error message like this :

[unixODBC][Driver Manager]Can't open lib '/usr/lib/odbc/libtdsodbc.so


sqlalchemy.exc.DBAPIError: (Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/lib/odbc/libtdsodbc.so' : file not found (0) (SQLDriverConnect)") None None
  • You need to update your tds driver template to


MyWiki: unixODBC (last edited 2017-07-31 14:43:33 by LukaszSzybalski)