views:

287

answers:

6

Hey, I want to know how to connect databases with C++? Any cross-platform solution which supports many databases? I know about SQLAPI++ but its a shareware... so any free one? What solutions do I have if I limit the OSes to Windows only?

Thanks

+1  A: 

What about sqlite?

http://www.sqlite.org/

Kevin D.
Doesn't really support "many databases" in the sense of "many different database engines". Certainly can be used to connect to multiple individual databases, but that's an uncommon restriction anyway...
Shog9
U're right, I got him wrong
Kevin D.
+2  A: 

Why not the Qt framework? its available under the LGPL now. Its simple to use, cross platform, free, provides an easy api to access several database engines without having to know about the underlying db.

Bob
A: 

You can use OTL (http://otl.sourceforge.net/) to connect to Oracle, and DB2-CLI Databases. It will also connect using ODBC, so if your DB supports that it should work.

It's based around C++ templeates.

It's free, but I'm not sure what license it's released under.

Glen
+2  A: 

For cross platform, both for your apps and for the databases they can use, your best bet is to use ODBC in some form. Try Googling for "odbc c++ wrapper" for a number of possible solutions.

anon
+4  A: 

SOCI - The C++ Database Access Library

yesraaj
A: 

You can check Debea - SQL Access and ORM for C++

Lukasz