If you have ever tried programming with PHP or at least know a little about this open source scripting language, you should also have heard from MySQL, the "world's most famous open source database". MySQL is very fast, free and its databases can be accessed from within many languages - C/C++ of course included. I will show you a short example how to connect to a MySQL server using plain C. There's a real C++ port too but that's something different.
First you need a MySQL server on your workstation or have access to a remote one. You'll also need the client libraries and headers installed so please check mysql.com. Under linux you simply have to install the necessary packages.
Step one: connect to the MySQL server.
We now have a connection to our MySQL server, either local or remote, and chosen the database we would like to work on. The next step is to retrieve data from a table in this database:
MySQL row's are represented as arrays of byte strings. But like getting data from the server we can also modify tables in the database - if we have the appropriate writing permission. That's even easier than getting data:
After this basic walkthrough you should be able to discover all other functions of the MySQL C API. If you have used PHP before you will see that most functions are very similar. If something's unclear, don't hesitate to ask! Happy C0ding!