Using a DB with C++ is a real mess and it was refreshing when I moved to Java to be able to use a unified system to abstract the whole layer away (aka Hibernate).
There
I don't know of any C++ library like Hibernate, but certainly there are non-vendor specific libs: SOCI and DTL