Setup ODBC on RHEL for MS SQL

Most enterprise sysadmins can’t afford to ignore the presence of Microsoft’s SQL Server in the data center. Steps to set up ODBC on RHEL for MS SQL follow.

These instructions were tested successfully on RHEL 6.

Taken from Perl to Microsoft SQL Server 2008 Standard via ODBC using FreeTDS by Lance Vermilion.

The following packages need to be installed:


In addition you may need the following:


For those who may need to work with perl scripts, the recommended route is to install:


(perl’s DBI package should already be installed)

Once the above prerequists above are installed, DBD::ODBC can be installed with:

perl -MCPAN -e "install 'DBD::ODBC'"

The following steps should be followed in order to install and configure ODBC for communicating with MS SQL:

1. Check to see what ODBC drivers are already installed:

odbcinst -q -d

2. Check the location of the ODBC configuration files:

odbcinst -j

In RHEL and Fedora this should be:

/etc/odbcinst.ini (driver definitions)
/etc/odbc.ini (connection objects)

2. Assuming the FreeTDS driver is not installed, here is how to set it up:

a. Create a TDS driver tempate for ODBC:


Driver = /usr/lib64/

b. Install the driver from this template:

odbcinst -i -d -f /var/tmp/tds.driver.template

c. Configure a connection object:


Driver = FreeTDS
Address =
Port = 1433
Database = TESTDB

d. Test the connection:

[me@mine]$ isql -v -s TESTDB testuser testpass
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |


Use this command to list all available DSNs:

odbcinst -q -s
This entry was posted in Database, System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).