hi,
You have mentioned 'connect to any database'. Initially its better to choose 1 database and start development.
You will need the interfaces(drivers and libraries) provided by the databases that you intend to use.
Do the proper installations and read the literature before jumping in.
For Oracle database there are OCI classes.
Official Oracle page for OCI[
^].
Similarly for MySql there is MySql Connector look at
tutorial here[
^]
For SQL Server you can refer to this
question[
^]
My previous answers to related questions
link1[
^] and
link2[
^]
If you plan to use some database other than these, then you can google for the interfaces they provide for working with C++.
hope this helps !!