In Oracle 9i, OCCI cannot be debugged under VC6.

Source: Internet
Author: User

Problem: OCCI cannot debug in VC6:

WinXP VC6-sp6 oracle9.2


Whether the OCCI library is divided into development and release versions. Therefore, oraocci9.lib of the release version cannot be used as a debug program. Errors will always be reported when the string or vector is released.


Why does the setXXX () function of the Statement class not work when I use it?


The document says that the NUMBER type can also be converted to the string type.

In

While (rs-> next ())

{

For (I = 0; I {

Cout <getString (I + 1) <;

}

Cout <}

In this section, why does the NUMBE type in the first line be read normally, but it is incorrect from the second line?

If I start next () several times before while (), all the number types in the first row of the current loop will be read normally, and it will be abnormal from the second row.

The solution is as follows:

The default debug step of vc6 certainly does not work. Because OCCI does not use this configuration to compile.

The procedure is as follows:

1. Make sure that oci. lib and oraocci9.lib are under your lib path and that oci/include is under your include path.

2. Make sure the following macro description is available: (# define WIN32COMMON)

# Ifdef WIN32COMMON

Template

Void getVector (ResultSet * rs, unsigned int index,

OCCI_STD_NAMESPACE: vector <T> & vect );

# Else

Template

Void getVector (ResultSet * rs, unsigned int index,

OCCI_STD_NAMESPACE: vector <T *> & vect );

# Endif


3. This step is the most important and should be different from the default configuration of VC6:

Under "link" of WIN32 DEBUG in project settings

Object/library modules:

Change to kernel32.lib user32.lib oci. lib msvcrt. lib msvcprt. lib oraocci9.lib (the sequence cannot be wrong)

At the same time, check Ignore all default libraries,

Enter libc. lib above Ignore libraries.

This will not cause heap errors during execution since the build. And debug is supported.

When you use occi to integrate with other databases, pay special attention to these configurations, and sometimes there may be incompatibility. Therefore, you need to select based on the actual situation.


Of course, you can use MTD and MD to build.

After VC7, there will be fewer OCCI requirements.

In linux, there are many bugs in OCCI. Unless 9205 or later patches are installed, you will almost never be able to use them normally.

If you encounter a similar problem, please give back in time.


Additional Notes:


Let's take a look at the relevant OCCI content in make. bat under $ ORACLE_HOMEocisamples:

: Occimakeobj

Ott userid = scott/tiger intype = % 1.typ outtype = % 1out. type code = cpp hfile = % 1h. h cppfile = % 1o. cpp mapfile = % 1m. cpp attraccess = private


Cl-GX-DWIN32COMMON-I. -I % ORACLE_HOME % ociinclude-I. -D_DLL-D_MT % 1.cpp % 1m. cpp % 1o. cpp/link/LIBPATH: % ORACLE_HOME % ocilibmsvc oci. lib msvcrt. lib msvcprt. lib oraocci9.lib/nod: libc

Goto end


: Occimake

Cl-GX-DWIN32COMMON-I. -I % ORACLE_HOME % ociinclude-I. -D_DLL-D_MT % 1.cpp/link/LIBPATH: % ORACLE_HOME % ocilibmsvc oci. lib msvcrt. lib msvcprt. lib oraocci9.lib/nod: libc

Goto end


Why is msvcrt. lib msvcprt. lib in the middle of/nod: libc? That is because the oracle occi library depends on different sequences during build. You can check on msdn why msvcrt. lib and msvcprt. lib are used.

There are also descriptions in Hou Jie's win32 multi-threaded programming.

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.