How does database connectivity work in C++?
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.