Install SQL ODBC driver on SUSE Linux

We have Few very good documents available for installing SQL ODBC on RedHat linux but when it comes to SUSE linux we don’t have one document which can help us end to end.

As we need to make sure we install right version of msodbcsql and also unixODBC


So lets start with what we have to do….


Steps to Install SQL ODBC driver on SuseLinux

We have followed following two articles (ans of course some common sense!!!):

sudo zypper addrepo opensuse-network-utilities-x86_64
sudo zypper install wget
sudo zypper install make
sudo zypper install gcc

1) Install msodbcsql archive for suse


2) unzip archive and put it in folder

tar -zxvf msodbcsql-11.0.2260.0.tar.gz

3)chnage directory to msodbcsql-11.0.2260.0

cd msodbcsql-11.0.2260.0

4) Install UnixODBC driver which is required for any ODBC connetcion to work


5) Unzip unix odbc to install it

tar -zxvf unixODBC-2.3.0.tar.gz

6)Now we have to install unixODBC driver and make sure it is installed correctly

./ --download-url=file://unixODBC-2.3.0.tar.gz.

It will ask whether you want to install script or not, say YES
After this it will go ahead and install unixODBC on your machine.

5) At the end it will tell to change directory to some temp path and run “make install” command
just copy pase those commands and it will do the trick.
Command for my machine was(most probably it will same for everyone, run each commadn separately):  ‘cd /tmp/unixODBC.8503.14603.23788/unixODBC-2.3.0; make install’

6) After this make sure you get back to your home directory
For my environment it needed following commands

cd home/<user name>/
cd msodbcsql-11.0.2260.0/

6)Now we have to install SQLODBC (make sure we are in directory msodbcsql-11.0.2260.0)
    -> make sure we are in directory msodbcsql-11.0.2260.0

    -> First we have to Run install script

sudo bash install --accept-license --force

    -> make sure the SQL Server dependencies are installed:

sudo zypper install openssl libkrb5-3 libc6 e2fsprogs

    –> run sqlcmd -?
        if it gives error “sqlcmd: error while loading shared libraries: cannot open shared object file: No such file or directory”
        run below command

sudo zypper install libopenssl0_9_8

    –> run sqlcmd -?
        and it rill show below output

 Microsoft (R) SQL Server Command Line Tool
Version 11.0.2260.0 Linux
Copyright (c) 2012 Microsoft. All rights reserved.

usage: sqlcmd [-U login id] [-P password]
[-S server or Dsn if -D is provided]
[-H hostname] [-E trusted connection]
[-N Encrypt Connection][-C Trust Server Certificate]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-b On error batch abort]
[-D Dsn flag, indicate -S is Dsn]
[-X[1] disable commands, startup script, environment variables [and exit]]
[-x disable variable substitution]
[-? show syntax summary]

    So now sqlcmd is ready for use.
    -> if it gives error regarding linking for crpto libraries (not needed if we have followed previous step correctly)
        Create some symlinks so everything works with the paths these binaries are expecting to find libraries: \        

 sudo ln -s /lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/;
sudo ln -s /lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/;
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/;
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/

I will finish this article here. 

If you have any questions feel free to add in comments section.