I'm writing an easy C++ application which can be placed on Linux or Home windows, and that will connect with a database. I would like my application to become compatible a minimum of with Oracle and MySQL (or PostgreSQL).

Which C or C++ library can you recommend to handle database queries: I'm available to any library, be it very thin (just execute SQL queries) or very body fat (an entire object persistence layer, clustering, etc.).

One library per answer, please. Just a little description (pros &lifier cons) could be great. Thanks.

I like using SOCI, it is extremely C++ like. If this involves performance regarding Oracle database, it's comparable with native OCI. It offers after sales with a RDBMS:

  • Oracle
  • PostgreSQL
  • MySQL

And more within the Resumes repository.

It's fairly easy to use, the documentation is thorough and rationale is fairly obvious. It supports connection pooling, has nice extensible method of transforming between datatypes.

This is just what ODBC was created for. Yes, it had been created by Microsoft, but you will find implementations on nearly every platform as well as for nearly every database product now.

I personally use SQLAPI++ and it is an excellent product. You can test it free of charge, it's easy to get began as well as their support is fantastic.

http://www.sqlapi.com/

I truly loved QtSql

  • It's the benefit of being smartly designed and mix platform.
  • Disadvantage is you need to purchase the license in case your application isn't free.

It's not necessary to make use of a QT GUI, but when you'll need a GUI library too it's wonderful.
In case your application is commercial and you do not need the relaxation from the QT library, I'd use another thing.

Seriously? Data Providers.

Nothing can beat designing your computer data requires each database. Generic solutions generally have a lot of compromises IMO.