Build an OCCI Development Environment

Source: Internet
Author: User

1. References

To do well, you must first sharpen your tools. Oracle official reference Document: Oracle Document. There are various documents, two of which are about oci and occi.

C language: Oracle Call Interface Programmer's Guide and Oracle C ++ Call Interface Programmer's Guide.

2. Build the vs2005 Development Environment

This article only describes how to build the OCCI development environment. The oci development environment is basically equivalent.

2.1 Download library and header file

: Http://www.oracle.com/technetwork/topics/winsoft-085727.html? SsSourceSiteId = ocomen

Because the instant client of Version 10.2 does not support the dynamic library of vs2005, even if the compilation is successful, various strange issues will be reported during the runtime.11.2.0.3.0Version.

To build a development environment, you need to download two files:

  1. Instantclient-basic-nt-11.2.0.3.0.zip. This package contains the dynamic link library that runs the OCCI program.
  2. Instantclient-sdk-nt-11.2.0.3.0.zip. This package contains the header file of the Development Library, the static Link Library, and the occi sample program.
2.2 Configuration

Extract the two packages downloaded in 2.1.

OCCI project properties-configuration properties-C/C ++-General-add the "instantclient_11_2 \ sdk \ include" directory after extraction to the directory;

The "instantclient_11_2 \ sdk \ lib \ msvc \ vc8" directory is added to the "OCCI project properties-" Configure properties-"connector-" General-"additional library directory;

Add the oraocci11.lib library to OCCI Project Properties> Configure Properties> connector> input> additional dependencies.

Copy the dll file in the decompressed instantclient_11_2 directory to the compiled executable file directory.

3. Problems Encountered in building the development environment 3.1 and 10.2

Because the system was originally installed with the Oracle client Version 10.2. The oci Development Library is automatically installed when the client is installed. I originally wanted to use the library of Version 10.2. I know this version does not support vs2005 and the compilation can be successful normally. If it is run, an odd error will be reported. Finally, we had to re-download the 11.2 Development Library.

3.2 build a linux development environment

The linux environment is similar to the vs2005 development environment. Since the oracle database and client are not installed on linxu, there is no interference. The dynamic link library directory is directly added to ldconf, so that you do not need to copy the dynamic link library to the executable program directory. Of course, in the win32 development environment, if you do not want to copy the dynamic link library, you can also set it in the environment variable PATH.

3.3 demo

For the demo in the downloaded package, do not expect to directly compile it to run. Modify the demo. mk file based on your system.

3.4 Chinese garbled characters

If garbled characters are displayed in Chinese, it is very likely that the character set is incorrect.

Use sqlplus to query:

SQL> select userenv ('language') from dual;

The server-side character set is SIMPLIFIED CHINESE_CHINA.ZHS16GBK.

You can directly specify the character set in the environment variable creation function, so you can create the environment variable as follows:

Env = Environment: createEnvironment ("ZHS16GBK", "ZHS16GBK ")

If the character set is paired, no garbled characters are generated.

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.