OCCI (Oracle C + + call Interface) development under Windows

Source: Internet
Author: User
Tags getmessage static class vc9 oracle database

If you have an ORACLE database installed under Windows, the Occi library and header files are under the directory%oracle_home%\oci.

Tools used here: VS 2005

(i) Basic settings

1. Install Oracle Instant Client
See Posts:

2. vs-> Tools-> Option-"solution-vc++-" contains file additions:
$ORACLE _home\oci\include

3. vs-> tool-> Option-"solution-vc++-" library file add:
$ORACLE _home\oci\lib\msvc\vc8

4. Right key Item-"Properties-" Configuration Properties-"connector-" input-"Additional dependencies add
Oraocci11d.lib

5 reboot vs on OK;

(ii) Error collection

1. Runtime prompt, "cannot start this program because the computer is missing OCI.dll"

Copy the OCI.dll to the debug directory under C:\oracle10g\product\10.2.0\db_1\BIN, and put it together with the EXE file.

2. A link error occurred at compile time

1>------Started Build: Project: Taxserver, configuration: Debug Win32------
1> is linking ...
1> is creating the library E:\TaxServer\Debug\TaxServer.lib and objects E:\TaxServer\Debug\TaxServer.exp
1>dbwrapper.obj:error LNK2019: unresolved external symbols "Public:virtual __thiscall oracle::occi::sqlexception::~sqlexception ( void) "(?? 1sqlexception@occi@oracle@ @UAE @xz), which is referenced in the function __catch$?open@dbwrapper@ @QAE_NXZ $
1>dbwrapper.obj:error LNK2019: unresolved external symbol "Public:virtual int __thiscall Oracle::occi::sqlexception::geterrorcode ( void) const "(? geterrorcode@sqlexception@occi@oracle@ @UBEHXZ), which is referenced in the function __catch$?open@dbwrapper@ @QAE_NXZ $
1>dbwrapper.obj:error LNK2019: unresolved external symbols "Public:virtual class std::basic_string<char,struct std::char_traits& Lt;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), which @QAE_NXZ $ in function __catch$?open@dbwrapper@ is referenced in
1>dbwrapper.obj:error LNK2019: unresolved external symbols "public:static class Oracle::occi::environment * __cdecl oracle::occi::env Ironment::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@zp6apax11i@zp6ax11@z@z), the symbol in the function " Referenced in Public:bool __thiscall dbwrapper::open (? open@dbwrapper@ @QAE_NXZ)
1>dbwrapper.obj:error LNK2019: unresolved external symbol "Public:static void __cdecl oracle::occi::environment:: Terminateenvironment (class Oracle::occi::environment *) "(?) terminateenvironment@environment@occi@oracle@ @SAXPAV123 @@z), which is in the function "Public:bool __thiscall dbwrapper::close (void) "(? close@dbwrapper@ @QAE_NXZ) referenced in
1>e:\taxserver\debug\taxserver.exe:fatal error Lnk1120:5 an unresolved external command
1> build log saved in "file://e:\taxserver\debug\buildlog.htm"
1>taxserver-6 an error, 0 warnings
========== Generation: 0 success, 1 failures, latest 0, skipping 0 ==========

A closer look, found only in some places link errors, such as SQLException, found to be procedural reasons,

The old version, VC7 under the process of compiling, under the VC9 can not pass.
Will
try {

catch (sqlexception& ex) {

}

Change into

try {

catch (SQLException ex) {

}


(iii) Problems

VS 2005 and VS 2008 are all compiled without Oracle Instant Client win-x86-64-11.1.0.7.0 To resolve the issue.

OCCI for VC9 download address: http://www.oracle.com/technetwork/database/occidownloads-083553.html


(d) Reference

Oracle is not required to install with Occi in VS2008 http://hi.baidu.com/nlpack/blog/item/b3b9a3fe57f6921a08244d65.html

VS2008 C + + connection to Oracle clients http://hi.baidu.com/%D1%E3%C9%F9%C1%F4/blog/item/d5bfdca8a327b4bfca130c83.html

Problems and solutions of Occi under VC6 in Oracle9i http://blog.csdn.net/iihero/article/details/1099908

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.