Problem solve Get help with specific problems with your technologies, process and projects.

How does database connectivity work in C++?

How does database connectivity work in C++?

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:

This was last published in October 2004

Dig Deeper on Oracle database backup and recovery

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.