Condividi tramite


Step by Step: Setting up Linux ODBC driver for SQL Server

After setting up Redhat Linux 6.3 in Hyper V image follow the instructions outlined on TechNet - https://technet.microsoft.com/en-us/library/hh568449.aspx to install the Driver Manager.

clip_image002 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1) Go to unixODBC (https://www.unixodbc.org/) page and select Download

2)

Download the unixODBC-2.3.0 version.

clip_image004

 

 

clip_image006

 

 

3) Extract the files

clip_image008

4) Start a Terminal session

Note: Ensure that gcc (C compiler) is installed and in PATH

Type the following commands, ensuring you are running as the root user and in the directory where the ODBC driver files where extracted.

CPPFLAGS="-DSIZEOF_LONG_INT=8

No messages will be seen after execution of this command

export CPPFLAGS

No messages will be seen after execution of this command

./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE

There will be compilation activity taking place and you will see the following screen:

clip_image010

Type make

There will be lots of messages similar to those on the screen

clip_image012

Type make install (this requires that you are logged in as the root user)

clip_image014

Now we can install the SSQL Server ODBC Driver for Linux. For more information see - https://technet.microsoft.com/en-us/library/hh568454.aspx

1) Extract out the native client files. These can be downloaded from - https://www.microsoft.com/en-us/download/details.aspx?id=28160. Ensure you download the appropriate version for your Red Hat version.

clip_image016

2) Open up Terminal window – change directory to the location where files where extracted

clip_image018

Type ./install.sh – it will just output information as per above screenshot. Next type ./install.sh verify. It will indicate if the computer has all the required components to install the Driver for Linux.

If it comes back with OK for all then we can proceed to install.

Type ./install.sh install

License agreement displays

clip_image020

Keep on pressing space bar to move the text along

Type YES if you agree to the license and to complete the installation

clip_image022

Run the following command to verify that the SQL Server ODBC Driver for Linux was registered successfully: odbcinst -q -d -n "SQL Server Native Client 11.0"

clip_image024

Test out connectivity to SQL Server using sqlcmd or Sample C++ code which can be found at - https://blogs.msdn.com/b/sqlblog/archive/2012/01/26/use-existing-msdn-c-odbc-samples-for-microsoft-linux-odbc-driver.aspx.

I used sqlcmd as per below screenshot:

clip_image026

 

Now your Linux based applications can enjoy the use of SQL Server 2012, so don't let the requirement of Linux applications stop you from using your favorite database system – SQL Server 2012.

Comments