Check if your system has already installed unixODBC and its
version using command with root login.
yum list installed unixODBC*
We are installing unixODBC-2.3.0
yum remove unixODBC
Go to: http://www.unixodbc.org/
- Click on Download – This will download ‘unixODBC-2.3.0.tar.gz’ file, copy to Linux machine.
1.
For further steps go to the ‘Manual Installation’
section of the link – ‘https://technet.microsoft.com/en-us/library/hh568449(v=sql.110).aspx’
OR
1. On your Linux computer, execute the command: tar
xvzf unixODBC-2.3.0.tar.gz
2. Change to the unixODBC-2.3.0 directory.
3. At a command prompt, execute the command: CPPFLAGS="-DSIZEOF_LONG_INT=8"
4. At a command prompt, execute the command: export
CPPFLAGS
5. At a command prompt, execute the 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"
6. At a command prompt (logged in as root),
execute the command: make
7. At a command prompt (logged in as root),
execute the command: make install
Then we have to install msodbcsql-11.0.2270.0.tar.gz
Go to link: http://www.microsoft.com/en-in/download/details.aspx?id=36437, download the module, copy to Linux machine. For further installation steps,
go to link - https://technet.microsoft.com/en-us/library/hh568454(v=sql.110).aspx.
OR
These instructions refer to msodbcsql-11.0.2270.0.tar.gz, which is
installation file for Red Hat Linux. If you are installing the CTP for SUSE
Linux, the file name is msodbcsql-11.0.2260.0.tar.gz.
|
To install the driver:
- Make sure that you
have root permission.
- Change to the
directory where the ODBC driver on Linux placed the file called
msodbcsql-11.0.2270.0.tar.gz. Make sure that you have the *.tar.gz file
that matches your version of Linux. To extract the files, execute the
following command, tar xvzf msodbcsql-11.0.2270.0.tar.gz.
- Change to the
msodbcsql-11.0.2270.0 directory and there you should see a file called
install.sh.
- To see a list of the available installation
options, execute the following command: ./install.sh
- Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that
are registered with the unixODBC Driver Manager. To discover the location
of odbcinst.ini on your computer, execute the following command: odbc_config --odbcinstini
- Before you install the
driver, execute the following command: ./install.sh verify. The output of ./install.sh verify reports if your computer has
the required software to support the ODBC driver on Linux.
- When you are ready to install the ODBC driver on
Linux, execute the command: ./install.sh
install . If you need to specify
an install command (bin-dir orlib-dir),
specify the command after the install option.
- After reviewing the
license agreement, type YES to
continue with the installation.
Installation puts
the driver in /opt/microsoft/msodbcsql/11.0.2270.0. The driver and its support
files must be in /opt/microsoft/msodbcsql/11.0.2270.0.
To verify that the
ODBC driver on Linux was registered successfully, execute the following
command: odbcinst -q -d -n
"ODBC Driver 11 for SQL Server"
Go to CPAN shell, install PERL module - install DBD::ODBC
After this add below line in /etc/odbc.ini file.
[Review]
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0
Server=122.xx.xx.xxx
Database=Review_Project_1
Trace=Yes
Below command is used to test connection:
isql -v "Review" {username} {password}
If you get the result like below, that means you are connected
successfully.
+------------------------------------+
| Connected! |
| sql-statement |
| help [tablename] |
| quit |
+------------------------------------+
You are ready to connect through PERL code. Cheers :)