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

unixODBC

apt-get update
apt-get install tdsodbc unixodbc

vi /etc/freetds/tds.driver.template

(Starting Debian Wheezy,Jessie)

[TDS]
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

[TDS]
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)

[TDS]
Description     = FreeTDS Driver for Linux & MSSQL on Win32
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so

vi /etc/freetds/tds.dsn.template

[DSN_NAME]
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

[SQLServer2008]
Description     = Production Server
Driver          = TDS
Trace           = No
Server          = servername\instance_name
TDS_Version     = 8.0

odbcinst -i -d -f /etc/freetds/tds.driver.template

odbcinst -i -s -l -f /etc/freetds/tds.dsn.template

odbcinst -i -s -f /etc/freetds/tds.dsn.template

isql -v DSN_NAME username password

**********************************************
* unixODBC - isql                            *
**********************************************
* Syntax                                     *
*                                            *
.
.
.
more
.

Troubleshooting

telnet myserver 1433

Trying 10.3.3.10...
Connected to myserver.
Escape character is '^]'.

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

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

or

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

/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

MyWiki: unixODBC (last edited 2016-03-30 21:04:30 by LukaszSzybalski)