Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install unxiodbc software and connect to oracle database

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Install unixodbc-- the following actions are performed under the root user

Installation process and error handling I refer to and refer to the resources on the network, but also combined with my own actual installation environment

First, install unixodbc tools

1. Download the unixodbc package (unixODBC-2.3.4.tar.gz) and upload it to the linux server with the ssh tool. (download address: http://www.unixodbc.org/)

2. Enter the following command to install:

# tar-zxvf unixODBC-2.3.4.tar.gz-- decompression

# cd unixODBC-2.3.4-- enters the unzipped installation directory

#. / configure-- prefix=/usr/local/unixODBC-2.3.4-- includedir=/usr/include-- libdir=/usr/lib-- bindir=/usr/bin-- sysconfdir=/etc-- configure the unixODBC-2.3.4 software

# make-- compiles unixODBC-2.3.4

# make install-- install unixODBC-2.3.4

Ps: when installing an application under Linux, you usually run the script configure first, then compile the source program with make, run make install, and finally run make clean to delete some temporary files (without making the last step).

Second, install the odbc driver of oracle database

1. Download, upload and install the following two rpm packages with the same version number

Oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm

Oracle-instantclient11.2-odbc-11.2.0.1.0-1.i386.rpm

Download address: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

# rpm-ivh oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm-installation operation

# rpm- ivh oracle-instantclient11.2-odbc-11.2.0.1.0-1.i386.rpmmuri-installation operation

Ps: download a 32-bit or 63-bit rpm package, which is determined by the linux system. With uname-a, you can view the current system model.

2. Copy / usr/lib/oracle/11.2/client/lib/* to the / usr/lib/ directory-- copy the dynamic connection shared library under oracle to the default path of linux system.

3. Execute ldconfig-- to load the oracle dynamic connection shared library added by linux system.

4. Create the file tnsnames.ora under / usr/lib/oracle/11.2/NETwork/admin/, as follows:

ORCL =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = ORCL)

)

)

Where ORCL is an identification name, the ServerName entry in the configuration file odbc.ini should correspond to it, SERVICE_NAME is followed by the name of the database to be accessed, HOST is the host IP address where the database is located, and PORT is the port number.

Ps: if you already have a tnsnames.ora file, just take a look at the configuration details.

5. Add new environment variable information to / etc/profile: export TNS_ADMIN=/usr/lib/oracle/11.2/network/admin/-- configuration

6. Execution. / etc/profile (note the preceding English full stop with a space after the period) register the environment variable

III. File configuration

It is mainly to modify the two configuration files odbc.ini and odbcinst.ini under / etc/.

1. Configure the drivers of each database in / etc/odbcinst.ini, such as

[oraclezy]

Description = odbc for Oracle-- description

Driver = / usr/lib/libsqora.so.11.1-- driver

Setup = / usr/lib/liboraodbcS.so-- Settings

FileUsage = 1

[ODBC]

Trace=1-- tracking

Debug=1-- debugging

Pooling=No

Ps: the fields followed by Driver and Setup in the above configuration may vary slightly due to different versions. If you want to take the library name or driver name on this machine as standard, you can check it with the ls command first.

2. Configure the ODBC API to be called by the application in / etc/odbc.ini in the following format:

[oracle]

# odbcinst.ini corresponds to the name in parentheses

Driver = oraclezy

Server = 192.168.1.167 or localhost

Port = 1521

# name of tns

ServerName = ORCL

UserID = root

Password = 123456 (mainly users registered when installing oracle database)

Fourth, test the connection

After completing the above operations, execute iqsl oracle (mainly the data source name in odbc.ini) root (user) 123456 (password)-v

Namely: isql oracle root 123456-v

When this interface appears, the installation and configuration is successful:

+-+

| | Connected! |

| | |

| | sql-statement |

| | help [tablename] |

| | quit |

| | |

+-+

SQL >

5. Error types of odbc connection oracle database

1. ORA-12170:TNS:Connect timeout occurred: connection timed out. Note whether servername and tnsnames.ora are consistent in / etc/odbc.ini configuration file.

Ps: when I was installing, I only encountered one error:

[01000] [unixODBC] [Driver Manager] Can't open lib'/ usr/lib/oracle/10.2.0.4/client

/ libsqora.so.10.1': file not found

[ISQL] ERROR: Could not SQLConnect

Treatment method:

The reason is that the package that libsqora.so.11.1 depends on does not have

Reference link: http://bbs.csdn.net/topics/390566189

1. Use the following command to view dependencies

# ldd / usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1

Linux-vdso.so.1 = > (0x00007fff99b1d000)

Libdl.so.2 = > / lib64/libdl.so.2 (0x00007fbcb52f1000)

Libm.so.6 = > / lib64/libm.so.6 (0x00007fbcb506c000)

Libpthread.so.0 = > / lib64/libpthread.so.0 (0x00007fbcb4e4f000)

Libnsl.so.1 = > / lib64/libnsl.so.1 (0x00007fbcb4c36000)

Libclntsh.so.11.1 = > / usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 (0x00007fbcb22c6000)

Libodbcinst.so.1 = > not found (0x00007fbcb20b5000)

Libc.so.6 = > / lib64/libc.so.6 (0x00007fbcb1d23000)

/ lib64/ld-linux-x86-64.so.2 (0x000000393aa00000)

Libnnz11.so = > / usr/lib/oracle/11.2/client64/lib/libnnz11.so (0x00007fbcb1955000)

Libaio.so.1 = > / lib64/libaio.so.1 (0x00007fbcb1754000)

Libltdl.so.7 = > / usr/lib64/libltdl.so.7 (0x00007fbcb154b000)

2. Use the following command to find the location of libodbcinst.so.1

# find /-name libodbcinst*

/ usr/lib64/libodbcinst.so

/ usr/lib64/libodbcinst.so.2

/ usr/lib64/libodbcinst.so.2.0.0

/ usr/lib/libodbcinst.so

/ usr/lib/libodbcinst.so.2

/ usr/lib/libodbcinst.so.2.0.0

There is no libodbcinst.so.1.

3. It is practical to solve the problem.

Copy / usr/lib64/libodbcinst.so.2 and / usr/lib/libodbcinst.so.2 respectively

# cp / usr/lib/libodbcinst.so.2 / usr/lib/libodbcinst.so.1

# cp / usr/lib64/libodbcinst.so.2 / usr/lib64/libodbcinst.so.1

Just rerun the verification command

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report