You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Kevac Marko <mk...@gmail.com> on 2008/07/09 14:59:46 UTC

mod_dbd and more than one database server

Hello.

Is there any way in mod_dbd to connect to more than one database server?

What is struct dbd_group_t? Something connected with more than one servers?
There are no comments at all about that in code.

-- 
С уважением, Кевац Марко
Sincerely yours, Kevac Marko

Re: mod_dbd and more than one database server

Posted by Kevac Marko <mk...@gmail.com>.
On Thu, Jul 10, 2008 at 7:18 AM, Kevac Marko <mk...@gmail.com> wrote:
> Thank you, but i need pool of connections too. So i think i'll fix
> mod_dbd to allow more than one connection pool and slightly change api
> to allow choosing pool of connections.

I am planning to implement something like this:

<DBDPool pool_name_1>
    DBDriver mysql
    DBDParam ...
    ...
</DBDPool>

<DBDPool pool_name_1>
    DBDriver mysql
    DBDParam ...
    ...
</DBDPool>

API will require pool name, something like this:
ap_dbd_acquire(request_rec*, const char *pool_name);
ap_dbd_open(apr_pool_t*, server_rec*, const char *pool_name);

Now what about groups...
User will be available to use same pool, by giving only pool name and
prepare statements:

<DBDPool name_that_already_exists>
    DBDPrepare ...
</DBDPool>

And if user set some variable, that is different from previous pool declaration:

<DBDPool name_that_already_exists>
    DBDriver different_from_that_one_in_name_that_already_exists
</DBDPool>

Than user will get something like "Your name_that_already_exists
definition contradicts with another definition. Please rename your
pool, or remove contradicting parameters".

What do you think about all that?

-- 
С уважением, Кевац Марко
Sincerely yours, Kevac Marko

Re: mod_dbd and more than one database server

Posted by Kevac Marko <mk...@gmail.com>.
Thank you, but i need pool of connections too. So i think i'll fix
mod_dbd to allow more than one connection pool and slightly change api
to allow choosing pool of connections.

On Thu, Jul 10, 2008 at 5:34 AM, Tom Donovan <do...@bellatlantic.net> wrote:
> If you are writing your own module, you could always open ad-hoc database
> connections directly using the apr-util functions apr_dbd_get_driver(),
> apr_dbd_open_ex(), apr_dbd_close(), etc. instead of using the pool of
> connections provided by mod_dbd.

-- 
С уважением, Кевац Марко
Sincerely yours, Kevac Marko

Re: mod_dbd and more than one database server

Posted by Tom Donovan <do...@bellatlantic.net>.
Kevac Marko wrote:
> Hello.
> 
> Is there any way in mod_dbd to connect to more than one database server?
> 

Yes - but only for different virtual hosts.

You can put different mod_dbd directives within different <VirtualHost> sections.  You can even use 
different DBDriver and DBDParams if you have completely different databases, e.g. MySQL and SQLite.

mod_dbd only provides connections from one set of mod_dbd directives per virtual host, so you can't 
access more than one database from the same virtual host.

If you are writing your own module, you could always open ad-hoc database connections directly using 
the apr-util functions apr_dbd_get_driver(), apr_dbd_open_ex(), apr_dbd_close(), etc. instead of 
using the pool of connections provided by mod_dbd.

-tom-