Occi (Oracle C ++ call interface) development in Windows
If the Oracle database is installed in windows, the occi library file and header file are in the directory % ORACLE_HOME % \ OCI.
Tools used here: VS 2005
(1) Basic settings
1. Install Oracle Instant Client
See Post:
2. vs-> Tools-> options-> solutions-> VC ++-> File Inclusion:
$ ORACLE_HOME \ OCI \ include
3. vs-> Tools-> options-> solutions-> VC ++-> library file Add:
$ ORACLE_HOME \ OCI \ Lib \ msvc \ vc8
4. Right-click Project-> properties-> Configure properties-> connector-> input-> Add Dependencies
Oraocci11d. Lib
5. Restart;
(2) highlights of errors
1. The system prompts "this program cannot be started because OCI. dll is lost in the computer"
Copy OCI. dll under c: \ Oracle10g \ product \ 10.2.0 \ db_1 \ bin to the DEBUG directory and put it together with the EXE file.
2. A link error occurs during compilation.
1> ------ generated: Project: taxserver, configuration: Debug Win32 ------
1> link...
1> creating Library E: \ taxserver \ debug \ taxserver. lib and Object E: \ taxserver \ debug \ taxserver. Exp
1> dbwrapper. OBJ: Error lnk2019: the external symbol "public: Virtual _ thiscall ORACLE: occi: sqlexception ::~ Sqlexception (void )"(?? 1sqlexception @ occi @ Oracle @ UAE @ xz). This symbol is in function _ catch $? Open @ dbwrapper @ qae_nxz $0 is referenced
1> dbwrapper. OBJ: Error lnk2019: the external symbol that cannot be parsed "public: Virtual int _ thiscall ORACLE: occi: sqlexception: geterrorcode (void) const "(? Geterrorcode @ sqlexception @ occi @ Oracle @ ubehxz). This symbol is used in function _ catch $? Open @ dbwrapper @ qae_nxz $0 is referenced
1> dbwrapper. OBJ: Error lnk2019: the external symbol that cannot be parsed "public: Virtual class STD: basic_string <char, struct STD: char_traits <char>, class STD :: allocator <char >>__ thiscall ORACLE: occi: sqlexception: getmessage (void) const "(? Getmessage @ sqlexception @ occi @ Oracle @ UBE? Av? $ Basic_string @ du? $ Char_traits @ d @ STD @ V? $ Allocator @ d @ 2 @ STD @ xz ).
_ Catch $? Open @ dbwrapper @ qae_nxz $0 is referenced
1> dbwrapper. OBJ: Error lnk2019: the external symbol that cannot be parsed "public: static class ORACLE: occi: Environment * _ cdecl ORACLE: occi: Environment: createenvironment (Enum ORACLE:: occi: Environment: mode, void *, void * (_ cdecl *) (void *, unsigned INT), void * (_ cdecl *) (void *, void
*, Unsigned INT), void (_ cdecl *) (void *, void *))"(? Createenvironment @ environment @ occi @ Oracle @ sapav123 @ w4mode @ 123 @ paxp6apax1i @ far @ zp6ax11 @ z @ Z). The symbol is in the function "public: bool _ thiscall dbwrapper :: open (void )"(? Open @ dbwrapper @ qae_nxz) is referenced
1> dbwrapper. OBJ: Error lnk2019: the external symbol that cannot be parsed "public: static void _ cdecl ORACLE: occi: Environment: terminateenvironment (class ORACLE: occi: Environment *) "(? Terminateenvironment @ environment @ occi @ Oracle @ saxpav123 @ Z). This symbol is used in the function "public: bool _ thiscall dbwrapper: Close (void )"
(? Reference in close @ dbwrapper @ qae_nxz)
1> E: \ taxserver \ debug \ taxserver.exe: Fatal error lnk1120: 5 External commands that cannot be parsed
1> the generated logs are stored in "file: // E: \ taxserver \ debug \ buildlog.htm"
1> taxserver-6 errors and 0 warnings
============ Generate: 0 successful, 1 failed, 0 latest, skipped 0 ==========
I found that some links are incorrect, such as sqlexception,
In earlier versions, the program compiled in vc7 cannot pass in vc9.
Set
Try {
} Catch (sqlexception & Ex ){
}
Change
Try {
} Catch (sqlexception ex ){
}
(3) Problems
VS 2005 and vs 2008 are compiled through the Oracle Instant Client win-x86-64-11.1.0.7.0, to be resolved.
Occi for vc9: http://www.oracle.com/technetwork/database/occidownloads-083553.html
(4) References
Use occi to connect to Oracle in vs2008 without installing the Oracle client http://hi.baidu.com/nlpack/blog/item/b3b9a3fe57f6921a08244d65.html
Problem http://hi.baidu.com/%D1%E3%C9%F9%C1%F4/blog/item/d5bfdca8a327b4bfca130c83.html of connecting vs2008 C ++ to Oracle client
In Oracle9i, the problem that occi cannot debug in vc6 and Its Solution http://blog.csdn.net/iihero/article/details/1099908