Cross-platform SQL DB API c / C ++

I am writing a database application in C linux. I am currently working on mysql, but later we can switch to postgres. Therefore, my boss asked me to prepare an application in order to be able to use any of the databases (mysql or postgres).

Is there a free api that I can use for this purpose? Or any suggestion on how I can do this?

+4
source share
2 answers

The official answer to this is ODBC.

If you don't like this (and let him look at it, nobody does), Qt has a database access module, QtSql . Obviously, this will require you to use Qt in your application.

+2
source

If you could find drivers for your platform, ODBC was supposedly designed for just that: a platform-independent way of talking to the database.

(I claim that in my experience, ODBC is such a mess that connecting to an ODBC driver is more difficult than just writing code three times for three different databases.)

+1
source

All Articles