Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the alternatives for a multidatabase library for C/C++?

Tags:

c++

c

database

I want to write an application which should be able to connect to multiple databases (this will be configured by parameters at startup). The application will have different queries for each database engine, this is not a problem.

The problem is that I want to be able to connect to different database engines. Java has JDBC, Perl has DBI. What does C++ have?

What's more I don't want to use database drivers with too strict licences (commercial ones). GPL could be - but I'd like to avoid that.

like image 554
Szymon Lipiński Avatar asked Jan 09 '12 00:01

Szymon Lipiński


1 Answers

Virtually every database engine in existence provides an ODBC interface. I think JDBC is actually a clone of ODBC.

What you want, then, is a C++ wrapper for the ODBC API, that implements RAII to make sure that database resources are released in case of exception, etc. For example: http://simpledb.sourceforge.net/

like image 116
Ben Voigt Avatar answered Oct 21 '22 04:10

Ben Voigt