SQL Server ODBC driver Getting Started Guide
How to access SQL Server 7.0–2022 and Express databases from Linux and UNIX.
Step 1: What you need to know
Before you begin, contact your database administrator for the following information:
- The hostname or IP address of the SQL Server machine.
- The name of an instance to connect to or the port that the instance is listening on.
- A valid SQL Server login name and password that can be used to connect to the database you want to access.
Step 2: Download the SQL Server ODBC driver distribution
-
Log in at the Easysoft web site.
If you have not yet done so, you need to register first. On the registration form, an asterisk (*) indicates that a field is mandatory.
-
Download the Easysoft SQL Server ODBC driver distribution for your Linux or UNIX platform.
The SQL Server ODBC driver is a single product that supports SQL Server 7—2022 and Express.
- Save the distribution file to a temporary directory on the machine where you want to install the SQL Server ODBC driver.
Step 3: Install the SQL Server ODBC driver
Note You need root access on the machine where you want to install the SQL Server ODBC driver.
- Log in to your Linux or UNIX system and
cd
into the directory where you downloaded the SQL Server ODBC driver distribution. For example:cd /tmp
- Unpack the distribution file:
tar -xvf odbc-sqlserver-version-platform.tar
Replace
version
andplatform
with the version number and platform contained in the distribution file name. For example, to unpack the 32-bit Linux distribution:tar -xvf odbc-sqlserver-2.2.0-linux-x86-glibc.tar
-
cd
into the directory created by unpacking the distribution file. For example:cd odbc-sqlserver-2.2.0-linux-x86-glibc
- To start the installation, as
root
, enter:./install
- Accept the default choices throughout the installation by pressing Return. To accept the terms of the Easysoft End User License Agreement, enter
Yes
. At certain points in the installation, the installation script pauses to report its progress. To continue to the next stage, press Return. - When prompted to choose a product to license, choose the SQL Server ODBC driver by typing its option number:
[0] Exit [1] View existing licenses [2] SQLServer ODBC Driver V2.2 Please choose the product you would like a license for by entering its item number or enter one of the other options. Option: 2
Next, you need to supply:
- Your full name.
- Your company name.
- An email contact address. This must be the email address you registered on the Easysoft web site.
- Your telephone number (you need to specify this if you telephone the license request to us).
- A reference number. When requesting a trial license just press Enter. This field is used to enter a reference number we will supply you for full (paid) licenses.
The license client asks you to choose a method for obtaining the license. To obtain a license automatically, you need to be connected to the Internet and allow outgoing connections to
license.easysoft.com
on port 8884. If you are not connected to the Internet or do not allow outgoing connections through port 8884, the license client can create a license request file, which you can:- Enter at the Easysoft web site to obtain your license.
- Supply to Easysoft by email or telephone.
If you choose option [2], the license request is written to a file named
license_request.txt
and you should exit the license client (option [0]) and complete the installation. Once you have emailed or telephoned the license request to us, we will return a license key. Add this to the end of the file/usr/local/easysoft/license/licenses
. - The installation searches for SQL Server instances that are listening on your network and displays the instances it finds. For example:
================================================================== ServerName MYSQLSERVER2019HOST Port 1433 (Default) ServerName MYSQLEXPRESSHOST\SQLEXPRESS Port 2777 ServerName MYSQLSERVER2022HOST\MYINSTANCEI Port 1510 ServerName MYSQLSERVER2022HOST\MYINSTANCEII Port 1511 ==================================================================
The example output shows that:
- The default SQL Server instance on a machine named
MYSQLSERVER2019HOST
is listening on the default SQL Server TCP port 1433. - The default named SQL Server Express instance on a machine named
MYSQLEXPRESSHOST
is listening on port 2777. - There are two named instances running on
MYSQLSERVER2022HOST
. The instances are listening on ports 1510 and 1511 respectively.
Do one of the following:
- If your SQL Server instance is displayed in the list, enter
y
. - If your SQL Server instance is not listed, enter
n
. The SQL Server instance may not be running or the SQL Server Browser or listener service that the installation uses to find SQL Server instances may not be running.Check with your database administrator that the SQL Server instance is running, and then skip to Step 4: Access a SQL Server ODBC Driver data source.
- The default SQL Server instance on a machine named
- Enter the host name (or IP address) of the machine where your SQL Server instance is running when prompted. To connect to a named instance, use the format
machinename
\instancename
. To connect to a SQL Server Express instance, use the formatmachinename
\SQLEXPRESS. To connect to a SQL Server instance that's not listening on the default port (1433), use the formatmachinename:port
.Based on the example output shown earlier, you would enter:
MYSQLSERVER2019HOST
to connect to the default instance on this machine.MYSQLEXPRESSHOST\SQLEXPRESS
to connect to the SQL Server Express instance.MYSQLSERVER2022HOST:1510
to connect to the first named instance on this machine andMYSQLSERVER2022HOST:1511
to connect to the second.
- Enter your SQL Server login name when prompted. If you usually connect to SQL Server through your Windows account, enter your Windows user name. If the SQL Server instance is running on a machine that's part of a Windows domain, use the format
domain
\user name
.Otherwise, enter a valid SQL Server user name.
- Enter the password for your user name when prompted.
If the installation can successfully connect to the SQL Server instance, a list of databases that you can access is displayed.
- Press Return to accept the default database for your SQL Server login.
- Press Return to accept the default language for SQL Server system messages.
The SQL Server ODBC driver installation has now gathered enough information to connect to SQL Server.
- Enter
y
when prompted whether to save the connection information in an ODBC data source and then enter a DSN. For example,mssql-linux-odbc-dsn
. You can use this data source to connect to SQL Server now and when the installation completes. The data source is written to/etc/odbc.ini
. - Enter
y
when prompted whether to retrieve a list of tables from the SQL Server databases.The installation uses unixODBC's isql program and your new data source to retrieve the data.
Note If you chose not to license the SQL Server ODBC driver earlier in the installation, skip this step. The SQL Server ODBC driver needs to be licensed before it can be used to connect to a data source. When the installation has finished, you can use isql to test the data source after you have licensed the SQL Server ODBC driver.
At the end of the installation, you will have installed and licensed the SQL Server ODBC driver, installed the unixODBC Driver Manager and created an ODBC data source.
- Set and export the
LD_LIBRARY_PATH
environment variable:LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/easysoft/sqlserver:/usr/local/easysoft/lib export LD_LIBRARY_PATH
Note On AIX, replace
LD_LIBRARY_PATH
withLIBPATH
.
Step 4: Access a SQL Server ODBC driver data source
- Do one of the following:
- If you interactively created a data source during the SQL Server ODBC driver installation, skip to step 5.
- If you did not create a data source during the installation, you need to create one. The SQL Server ODBC driver installation creates a sample data source named
SQLSERVER_SAMPLE
that you can use as a starting point.
- As root, open
/etc/odbc.ini
in a text editor. - To locate the sample data source, search for
[SQLSERVER_SAMPLE]
. - Change these attribute values:
Attribute Value Server
The host name (or IP address) of the machine where your SQL Server instance is running. To connect to a named instance, use the format machinename
\instancename
. To connect to a SQL Server Express instance, use the formatmachinename\SQLEXPRESS
.Port
If the SQL Server instance is listening on the default port, leave this set to 1433
. If your database administrator told you to specify a different port, replace1433
with the new port number. Otherwise, delete1433
.Database
Delete the sample entry Northwind
to connect to the default database defined for your login.User
Your SQL Server login name. If you usually connect to SQL Server through your Windows account, enter your Windows user name. If the SQL Server instance is running on a machine that's part of a Windows domain, use the format domain
\user name
. Otherwise, enter a valid SQL Server user name.Password The password for the login name specified by User
.Examples
This data source uses a Windows user name and password to connect to the default SQL Server instance on a machine named
MYSQLSERVER2019HOST
.[SQLSERVER_SAMPLE] Driver = Easysoft ODBC-SQL Server Description = Easysoft SQL Server ODBC driver Server = MYSQLSERVER2019HOST Port = 1433 Database = User = mydomain\mywindowsuser Password = mywindowspassword
This data source uses a SQL Server user name and password to connect to a SQL Server Express instance. The SQL Server port is omitted and the SQL Server ODBC driver will therefore use the SQL Server Browser to detect the port.
[SQLSERVER_SAMPLE] Driver = Easysoft ODBC-SQL Server Description = Easysoft SQL Server ODBC driver Server = MYSQLEXPRESSHOST\SQLEXPRESS Port = Database = User = mysqlserverusername Password = mysqlserverpassword
- Use
isql
to test the new data source:cd /usr/local/easysoft/unixODBC/bin ./isql -v dsn_name
where
dsn_name
is name of your ODBC data source. If you created a data source during the SQL Server ODBC driver installation, specify that data source name. If you have just edited the sample SQL Server ODBC driver data source, enterSQLSERVER_SAMPLE
.If you are unable to connect, refer to the Easysoft SQL Server ODBC driver knowledge base for help on solving some common connection problems.
- At the prompt, enter a
SELECT
statement or enterhelp
to display a list of tables. To exit, press Return in an empty prompt line.
What next?
You are now ready to use the SQL Server ODBC driver with your own applications and development tools.
Further support
- The Easysoft SQL Server ODBC driver User's Guide provides detailed installation instructions. This manual is also available as a PDF.
- The Easysoft SQL Server ODBC driver knowledge base.
- To contact the Easysoft support team, send an email message to .