Keywords: How to Install unixODBC,freeTDS on Debian Linux.
unixODBC
- 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 :
[TDS] 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:
[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
- OR If you are using mssql with multiple instances and dynamic port allocation you can use the following:
[SQLServer2008] Description = Production Server Driver = TDS Trace = No Server = servername\instance_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 * * * . . . more .
Troubleshooting
- 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:
Trying 10.3.3.10... 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.