Ask the Expert

How does database connectivity work in C++?

How does database connectivity work in C++?

    Requires Free Membership to View

You'll want to use one of two methods: Pro*C or OCI for C++. Both are Oracle products and are installed with your database software. Pro*C is the easiest of the two to use, but OCI has all of the power. With Pro*C, you place SQL statements in your C++ code. You also place the simple statements to make a database connection and disconnection in your C++ code. Before you compile the C++ code, you run your source program through a precompiler. This precompiler essentially takes your simple database lines of code in your C++ source code and expands it into everything that is needed to perform that statement. You then run your precompiled code through your C++ compiler.

I would highly recommend reading the Pro*C/C++ Precompiler Programmer's Guide. It contains sample code to help you along the way. You can find a copy of that doc here:

http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a97269/toc.htm

This was first published in October 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: