Vous êtes sur la page 1sur 6

Create ODBC Connection in Linux

This document will describe Step by Step how to create ODBC Connection in Oracle Linux, The
Concept is the same for Linux version, you can use it but you need to install Different Package

Operating system: Oracle Linux 6.4


Database version: 11.2.0.4

Thank you for Ilmar Kerm to mention Oracle Instant

Create ODBC Connection in Linux

About the Author

Osama Mustafa Oracle ACE, a database specialist, Certified Oracle Professional (10g, 11g),
Certified Ethical hacker (Penetration testing), and Sun System Administrator, author of book
Oracle Penetration Testing. Publishes many articles, including Oracle database articles in his
blog,Fusion Middle Ware and Oracle RAC Documentation, Including to this he is Active
Member On Oracle OTN and other Groups.

Twitter: @OsamaOracle.
G+: Osama Mustafa.
Slid-Share: Osama Mustafa.
LinkedIn: http://www.linkedin.com/in/osamamustafa.
Blog: http://osamamustafa.blogpsot.com.

Create ODBC Connection in Linux

Heading to
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Check which version of database you need, and download it. In my case I am using 11.2.0.4

Create ODBC Connection in Linux

Copy the Both Package & Zip file to Server using winscp Software.

[OPTIONAL]

This Step if you dont have Driver Manager on your server, to check this you need to check if
odbc.ini,or odbcinst.ini exists on your server, if yes skip this step, else no continue reading.
Now using any browser open http://www.unixodbc.org/

Copy it the Server


[root@OEL6 u01]# gunzip unixODBC-2.3.2.tar.gz
[root@OEL6 u01]# tar unixODBC-2.3.2.tar

Now you should be able to see new folder with name unixODBC-2.3.2
[root@OEL6 u01]# cd unixODBC-2.3.2
Follow these steps to install unixODBC (Driver Manager) on your Server:
[root@OEL6 u01]# ./configure --prefix=$HOME --enable-gui=no --enable-drivers=no
$HOME Where you want to install ODBC ,in my case I install it on /u01/app/ODBC
This supposed to take about 1 minute to interrupted, Dont Change the Directory

Create ODBC Connection in Linux


[root@OEL6 unixODBC-2.3.2]# make
[root@OEL6 unixODBC-2.3.2]# make install
The Above two Steps Will take some time please wait.
Now you are installed Driver Manager Check /u01/app/ODBC, you should be able to see the below
files:
drwxr-xr-x. 3 root root 4096 Dec 17 00:26 share
drwxr-xr-x. 2 root root 4096 Dec 17 00:26 include
drwxr-xr-x. 2 root root 4096 Dec 17 00:26 bin
drwxr-xr-x. 3 root root 4096 Dec 17 00:56 etc
drwxr-xr-x. 2 root root 4096 Dec 17 01:37 lib

Do you still Remember the Zip & Packages downloaded from Oracle Site, we need to use it now:
[root@OEL6 u01]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
Preparing...

########################################### [100%]

[root@OEL6 u01]# rpm -ivh oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm


Preparing...

########################################### [100%]

This is for two package now unzip the folder ( under /u01 )
[root@OEL6 u01]# unzip instantclient-odbc-linux.x64-11.2.0.4.0.zip
[root@OEL6 u01]# cd instantclient_11_2/
[root@OEL6 instantclient_11_2]# ls
libsqora.so.11.1
ODBC_IC_Readme_Unix.html
ODBCRelnotesJA.htm
ODBCRelnotesUS.htm
odbc_update_ini.sh
[root@OEL6 instantclient_11_2]# ./odbc_update_ini.sh /u01/ODBC/

It will be fast

Create ODBC Connection in Linux


Now Driver , and ODBC installed But need to be configured on the server
[root@OEL6 ODBC]# cd /u01/ODBC/etc/
[root@OEL6 etc]# ls
total 12
drwxr-xr-x. 2 root root 4096 Dec 17 00:26 ODBCDataSources
-rw-r--r--. 1 root root 89 Dec 17 00:56 odbc.ini
-rw-r--r--. 1 root root 375 Dec 17 01:51 odbcinst.ini
Using any Editor Open odbcinst.ini by default it will look like this :
[Oracle 11g ODBC driver]
Description = Oracle ODBC driver for Oracle 11g
Driver
= /u01/instantclient_11_2/libsqora.so.11.1
Setup
=
FileUsage
=
CPTimeout
=
CPReuse
=
Copy it and paste in the same the same file
[TEST]
Description
Driver
Setup
FileUsage
CPTimeout
CPReuse

= TEST ODBC
= /u01/instantclient_11_2/libsqora.so.11.1
=
=1
=5
=5

Save it and exist.


Now on the same folder etc you will find odbc.ini , with any editor open it and add the below tags :
[TS]
Description = "TEST"
Driver = TEST should be same as Driver Above.
Server = SERVER Database Server IP
Port = 1433 Port for Listener
Database = DBNAME Using show parameter name.

To Test ODBC:
[root@OEL6 lib]# cd /u01/ODBC/bin/
[root@OEL6 bin]# ./isql -v [ODBC_NAME] Username password

Vous aimerez peut-être aussi