FirstGo to the Oracle official website to download the C language library file and header file URL as follows, select the corresponding Instant Client Version (I downloaded all zip packages without downloading the rpm package, the rpm package should be configured during installation ):(I personally recommend that you use a zip package to improve your understanding.)
Http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
The following is the version of linux i386
Http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
Instant Client Package-Basic contains the dynamic library file libclntsh. so.11.1 (the latest version may be different) and loads it to the dynamic library search path.(Specific operation of sudo mv *. so/usr/bin).
* The Instant Client Package-SDK contains the header file.
* Instant Client Package-SQL * Plus sqlplus is better to be installed next. test whether the Client is configured and check whether all SQL statement execution results require it.
The following are my three:
Instantclient-basic-linux32-11.2.0.2.0.zip
Instantclient-sdk-linux32-11.2.0.2.0.zip
Instantclient-sqlplus-linux32-11.2.0.2.0.zip
Download file path settings:
/Home/oracle/lib stores various library files of Basic and sqlplus, so in/etc/ld. so. add the path/home/oracle/lib to the conf file, and the path is libclntsh in the current file. so.11.1 create a soft connection ln-s libclntsh in the library file. so.11.1 libclntsh. so allows the code to find the library file when connecting to the dynamic library. (In fact, there are a lot of. so files, all of which are dynamic libraries. They must be placed in the dynamic library like libclntsh. so.11.1 to find the library files.)
Run ldconfig
/Home/oracle/include stores the SDK header file.
# Tnsnames. ora Network Configuration File:/home/oracle/product/10.2.0/db_1/network/admin/tnsnames. ora TEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.8) (PORT = 1521 )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) ) )
EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1 )) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
|
After the preceding settings are configured, log out of the user and log on again to make the ORACLE_HOME environment variable take effect. The check method is very simple. Run the following commands on the terminal:
[Www.bkjia.com @ localhost ~] $ Echo $ ORACLE_HOME
/Home/oracle
If there is a path output as above, the configuration is successful. If there is no output, edit it again ~ /. Bashrc to see what went wrong.
After the check is complete, run sqlplus to log on to the database! The example is as follows. The C program is successfully connected to the database! Finally, the environment has been configured.
In fact, there is still a problem at this time (it is estimated that I haven't updated it for a long time, it may be a problem), that is. /sqlplus: error while loading shared libraries: libaio. so.1: cannot open shared object file: No such file or directory
Remedy: sudo apt-get install libaio1
Connection time: sqlplus test/test@192.168.17.151/test