Install the ODBCforOracle driver in Linux

Source: Internet
Author: User
Recently, I am working on a project to create an oracle database system under RHEL5 to store the recording data of the cluster. The database driver uses odbc. Here, I will simply record the Security

Recently, I was working on a project to create an oracle database system under RHEL 5 to store the recording data of the cluster. The database driver uses odbc, which is a simple record of the security

Recently, I was working on an Oracle database system under RHEL 5 to store the recording data of the cluster. The database driver is odbc, here is a simple record of how odbc is installed and configured.

1. Install ODBC

From, download the unixodbc-2.3.0.tar.gz, decompress it: tar zxvf unixODBC-2.3.0.tar.gz

In the decompressed folder, execute:./configure, then make, and then make install.

Sadly, no matter whether you enter/usr/local/bin or/usr/bin, you cannot find ODBCConfig. If you cannot find it, find/-name "ODBCConfig" or not. Depressed. What's going on? Google baidu, some people said that did not install gt package for the reason, okay, install it first, download the unixODBC-gui-gtk-2.2.1-i386.rpm and unixODBC-gui-qt-2.2.1-i386.rpm, then install, reinstall unixODBC, the result is still unable to find the ODBCConfig, super depressed.

That is not the unique feature of unixodbc. in this case, unixodbc-2.2.1.tar.gz is downloaded, And omg is finally found under/usr/local/bin.

Ii. Configure ODBC for oracle

2.1 install the oracle instant client

Download the rpm installation package of the oracle instant client. The zip package can also be:

Oracle-instanceclient11.2-basic *. rpm
Oracle-instanceclient11.2-devel *. rpm
Oracle-instanceclient11.2-odbc *. rpm
Oracle-instanceclient11.2-sqlplus *. rpm

Since the instant client has been installed before, it is forced to install. Pay attention to the sequence: rpm -- force-ivh *.

The default installation location is/usr/share/oracle/11.2/client,/usr/include/oracle/11.2/client,/usr/lib/oracle/11.2/client,

Before setting environment variables, create the network/admin folder under/usr/lib/oracle/11.2/client/lib, and create tnsnames. ora under this folder:

ORCL =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.2) (PORT = 1521 ))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

Set environment variables:

# Vi ~ /. Bashrc

Add the following content to the file:

Export ORACLE_HOME =/usr/lib/oracle/11.2/client/lib

Export ORACLE_SID = orcl

Export TNS_ADMIN = $ ORACLE_HOME/network/admin

Export LD_LIBRARY_PATH = $ ORACLE_HOME

Export SQLPATH = $ ORACLE_HOME

PATH = $ PATH: $ ORACLE_HOME

Export PATH

Effective immediately # source ~ /. Bashrc

Since the oracle server has been installed on the local machine, the following test shows whether the client is successfully installed:

# Sqlplus/nolog

SQL> conn test/test @ orcl

The problem of ora-12541, Solution:

Because the server does not enable the listener, log on to the server,

$ Lsnrctl start

Then log on:

# Sqlplus/nolog

SQL> conn test/test @ orcl

OK. The instant client is successfully installed.

2.2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.