[odb-users] Support more then one database vendor in a single application?

Oded Arbel oded at geek.co.il
Tue Aug 21 08:55:57 EDT 2012

Hi ODB people.

I'm writing an application that I want to use with multiple database
servers, from multiple vendors (actually only two - I use MS-SQL as a
"serious database" and SQLite for "database server is optional" mode).

I was thinking of writing database agnostic model (with some #ifdefs in the
more hairy parts, though for most cases ODB vendor agnostic pragmas are
enough), then run the ODB compiler twice to generate two code sets - one
for each database vendor, then build two DLLs out of the whole shebang and
load either one in the application depending on the runtime configuration.

When I started to work on that, I got into a lot of trouble (I'm a C++
newbie, so it may as well be all my fault). Has anyone tried to do
something like this, and if so - what approach did you take?

The main problem I have is that, building for MS-Windows, I have to use
__declspec(dllexport) on the model API, and that causes the VC++ compiler
to get really upset that ODB types do not declare dllexports as well.


More information about the odb-users mailing list