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.
1) Go to unixODBC (https://www.unixodbc.org/) page and select Download
2) | |
Download the unixODBC-2.3.0 version.
|
3) Extract the files
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:
Type make
There will be lots of messages similar to those on the screen
Type make install (this requires that you are logged in as the root user)
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.
2) Open up Terminal window – change directory to the location where files where extracted
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
Keep on pressing space bar to move the text along
Type YES if you agree to the license and to complete the installation
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"
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:
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.