OTL use method 1 source http://otl.sourceforge.net/http://otl.sourceforge.net/otlv4_h.zip () 2 install 2.1 Windows XP, vc6.0, oracle8.1.61) unzip the downloaded installation package to C: /program files/Microsoft Visual Studio/vc98/otlv4_h/otlv4.h. 2) Add C:/program files/Microsoft Visual Studio/vc98/otlv4_h in tools> Options> directories> include files under VC. If the OCI path is not set, 3) add C:/Oracle/ora81/OCI/include to tools> Options> directories> include files under VC. 4) add C:/Oracle/ora81/OCI/lib/msvc to tools> Options> directories> library files under VC. 2.2 UNIX Solaris, GCC, oracle9.2 unzip the downloaded installation package. 3. Test Windows XP, vc6.0, and oracle8.1.61 in 3.1. Create a console empty project. Set the type to Win32 console application and finish. 2) Enter OCI. Lib under project> Settings> link> Object/library modules. 3) Copy otl4_examples/ex10_oci8.cpp to the project directory. 4) on the FileView page of the workspace window, right-click ** files, select add files to project from the pop-up menu, and add ex10_oci8.cpp. 5) modify the source Program As follows:
# Include <iostream> // using namespace STD; # include <stdio. h> # define otl_ora8i // compile OTL 4/oci8 # include <otlv4.h> // include the OTL 4 header fileusing namespace STD ;'...... Int main () {otl_connect: otl_initialize (); // initialize OCI environment try {dB. rlogon ("username/password @ Sid"); // connect to Oracle |
Figure 0 ‑ 1 the modified Source code 3.2 UNIX Solaris, GCC, oracle9.21) Copy ex10_oci8.cpp to a directory. 2) modify the source file as follows:
# Include <iostream> using namespace STD; # include <stdio. h> # define otl_ora8i // compile OTL 4/oci8 # include "otlv4.h" // include the OTL 4 header fileusing namespace STD ;'...... Int main () {otl_connect: otl_initialize (); // initialize OCI environment try {dB. rlogon ("username/password @ Sid"); // connect to Oracle |
Figure 0 ‑ 1 source after modification Code 3) Compile the MAKEFILE file, for example:
ALL: ex10_oci8.cpp g ++ ex10_oci8.cpp/-I $ {ORACLE_HOME}/rdbms/demo-I $ {ORACLE_HOME}/rdbms/public-I $ {ORACLE_HOME}/Network/public/-L $ {ORACLE_HOME}/lib32-lclntsh |
Figure 0 Example 2 makefile