The procedure is as follows:
//
// 1. After installationOracle 11g R2 for x64 LinuxCopy the occi header file and library file:
// (1). Copy the header file
// Mkdir-P ~ /OCCI-11gR2-X64/include
// CP $ ORACLE_HOME/rdbms/public /*~ /Occi/include/
//
// (2). Copy the library file and create a soft link
// Mkdir-P ~ /OCCI-11gR2-X64/LIB;
// CP $ ORACLE_HOME/lib/libocci. so.11.1 ~ /OCCI-11gR2-X64/lib/
// CP $ ORACLE_HOME/lib/libclntsh. so.11.1 ~ /OCCI-11gR2-X64/lib/
// CP $ ORACLE_HOME/lib/libocci11.a ~ /OCCI-11gR2-X64/lib/
// CP $ ORACLE_HOME/lib/libclntst11.a ~ /OCCI-11gR2-X64/lib/
//CP $ ORACLE_HOME/lib/libnnz11.so ~ /OCCI-11gR2-X64/lib/<this library must also be copied, it is dependent on libclntsh. so.11.1>
// Cd ~ /Occi/LIB;
// Ln-s libclntsh. so.11.1 libclntsh. So;
// Ln-s libclntsh. So libclntsh. so.10.1
// Ln-s libocci. so.11.1 libocci. So
//
// (3). The OCCI-11gR2-X64/lib directory structure is as follows
/*
[Oracle @ gd47 lib] $ LS-l
Total 58424
Lrwxrwxrwx 1 Oracle oinstall 17 12-07 20:50 libclntsh. So-> libclntsh. so.11.1
Lrwxrwxrwx 1 Oracle oinstall 12 12-07 20:51 libclntsh. so.10.1-> libclntsh. So
-Rwxr-XR-x 1 Oracle oinstall 48725793 12-07 libclntsh. so.11.1
-RW-r -- 1 Oracle oinstall 0 12-07 20:46 libclntst11.a
-RW-r -- 1 Oracle oinstall 7899997 12-07 libnnz11.so
-RW-r -- 1 Oracle oinstall 1863334 12-07 20:45 libocci11.a
Lrwxrwxrwx 1 Oracle oinstall 15 12-07 20:49 libocci. So-> libocci. so.11.1
-Rwxr-XR-x 1 Oracle oinstall 1260923 12-07 libocci. so.11.1
*/
//
// 2. Package the OCCI-11gR2-X64 Directory into a OCCI-11gR2-X64.tar.gz (download) and copy it to your machine.
//
// 3. Unzip the OCCI-11gR2-X64.tar.gz on the client machine, for example, directory structure:/home/zhankunlin/Oracle/OCCI-11gR2-X64
//
// 4. Compile the occi program on the client machine. The makefile can be written as follows:
//
/*
Occi_home =/home/zhankunlin/Oracle/OCCI-11gR2-X64.
Occi_include_dir = $ (occi_home)/include
Occi_library_path = $ (occi_home)/lib
# Attention: you must add "-lnnz11 ".
Cpporacle:
G ++ cpporcl. cpp-O test-I $ (occi_include_dir)-L $ (occi_library_path)-locci-lclntsh-Lnnz11 <Note: you must add the lnnz11 link libnnz11.so>
*/
//
// 5. Run. First set the LD_LIBRARY_PATH environment variable, and then run the program
//
Export LD_LIBRARY_PATH =/home/zhankunlin/Oracle/OCCI-11gR2-X64/lib
./Test
Note:
Although there is no compilation problem, an exception error is reported when a problem occurs during running,
"Error while trying to retrieve text for error ORA-01804"
The occi program may be executed with non-Oracle Database Installation users in Linux.
The issues mentioned are related.