How to install unixODBC on linux system


Open DataBase Connectivity (ODBC) is a cross-platform, call-level interface that allows applications to access data in any database for which there is an ODBC driver. Using ODBC, you can create database applications with access to any database for which your end-user has an ODBC driver. ODBC provides an API that allows your application to be independent of the source database management system (DBMS). This enables for software developers to write open database programs without the need of a proprietary interface
1) download software
2) untart the files

gunzip unixODBC-2.3.1.tar.gz
tar xvf unixODBC-2.3.1.tar
cd unixODBC-2.3.1


To install the Oracle Instant Client
Go to the “Install Client Downloads” page on the Oracle website. Choose the link that matches your system type (for instance, Instant Client for Linux x86-64). Choose Accept License Agreement at the top of the page and download the following RPM or zip files for your target version (such as 11.2):

The process of connecting Oracle to Moab Workload Manager has been tested on Oracle Instant Client version 11.2. The process may work with other versions, but they are not supported.
Basic (oracle-instantclient11.2-basic-
SQL Plus (oracle-instantclient11.2-sqlplus-
ODBC (oracle-instantclient11.2-odbc-
Install the packages. This example installs the RPMs.
[root]# rpm -i ./oracle-instantclient11.2-basic-
[root]# rpm -i ./oracle-instantclient11.2-sqlplus-
[root]# rpm -i ./oracle-instantclient11.2-odbc-

3) to install the unixodbc run below command

./configure –libdir=/usr/lib64 –sysconfdir=/etc –enable-gui=no –enable-drivers=yes –enable-drivers-conf=yes
make install

–enable-drivers: This parameter enables building the drivers that were installed by default in previous versions.

–enable-drivers-conf: This parameter enables building the driver configuration libraries that were installed by default in previous versions.

Oracle installs the library in /usr/lib/oracle/11.2/client64/lib. set the library path, add it to the profile (as required)

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/11.2/client64/lib
Test Oracle Driver installation

dltest /usr/lib/oracle/11.2/client64/lib/

SUCCESS: Loaded /usr/lib/oracle/11.2/client64/lib/

4) verify the installtion

]# odbcinst -j
unixODBC 2.3.1
DRIVERS…………: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /etc/odbc.ini
SQLULEN Size…….: 8
SQLLEN Size……..: 8

5) Specify the Driver location in odbcinst.ini file

vi /etc/odbcinst.ini

Description=Oracle Unicode driver

6) Set database connection information in odbc.ini file and specified the driver which you have mentioned in odbcinst.ini file

vi : /etc/odbc.ini

Driver = PostgreSQL
Description = PostgreSQL ODBC
Servername = xyz
Port = 5432
Database = mydb
Username = myuser
Password = pass
ReadOnly = false
ShowSystemTables = false
LegacySQLTables = false
LoginTimeout = 0
QueryTimeout = 0
DateFormat = 1
NumericAsChar = false
SQLBitOneZero = false
StripCRLF = false
securityLevel = preferredUnSecured
caCertFile =


7) Export the environment variable

]# export ODBCSYSINI=/etc
]# export ODBCINI=/etc/odbc.ini

8) test connection

]# isql -v MYDATA
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |

query system dsn’s

]#odbcinst -q -s

Dltest -> is a utility used to check a share library to see if it can be loaded and if a given symbol exists in it.
Isql‡ is an utility which can be used to submit SQL to a data source and to format/output results. It can be used in batch or interactive mode.
Iusql -> provides the same functionality as the isql program.
odbc_config -> is used to find out details about the installation of the unixODBC package.
Odbcinst->is an utility created for install script/RPM writers. It is a command line interface to key functionality in the libodbcin