apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Rossi <bob_ro...@cox.net>
Subject Re: database independent connections
Date Thu, 29 Nov 2007 22:34:58 GMT
On Fri, Nov 30, 2007 at 09:21:56AM +1100, Bojan Smojver wrote:
> On Thu, 2007-11-29 at 16:43 -0500, Bob Rossi wrote:
> > I'm a newb with database connections, so forgive me if this is a simple
> > question. I'm looking into using the dbd routines to open connections 
> > to a database. The routines are here,
> >   http://apr.apache.org/docs/apr-util/1.2/group___a_p_r___util___d_b_d.html
> > 
> > I want to know if this interface allows me to easily swap out the
> > underlying database so I don't get stuck using a particular database.
> > Say perhaps, could the same code use mysql, oracle or db2?
> > Also, how does sqlite play into it?
> MySQL, yes. Oracle, only with trunk (i.e. unreleased version 1.3 of
> APU). DB2, no (feel free to contribute the driver! :-). SQLite 2 and 3,
> yes.
> Yes, APU DBD is an abstraction layer on top of native database APIs, so
> you should be able to use the same code with different databases,
> provided that SQL you pump in is supported by databases in question.

You know, this is exactly what i want and hoped for. Sometimes I just
love this open source stuff...

> > I'm looking for high level advice on how to design software that needs
> > to open connections from different sources using the apr API.
> You can have a look at the source of mod_dbd of Apache, for instance.
> For a quick a dirty intro, look at the test/testdbd.c program in the
> tarball of APU.

OK, perhaps we could have some high level documentation on the webpage
for the dbd documentation that describes which databases it works with?

Bob Rossi

View raw message