Chris Winters wrote:
[EMAIL PROTECTED]">* Tommy Davis ([EMAIL PROTECTED]) [010502 04:11]:
We use a server-setup with a mod_perl enabled backend server. The server
only runs mod_perl and mySQL for about 5 virtual hosts.
...
Another problem is that the solutions uses diffferent databases. That
means we end up with 5 ttimes as many open db handles as we have
mod_perl processes.
We have worked around this by merging all databases into a single one,
prefixing the table_names with the former db-names and using a simple
abstraction layer to access the database.
I'm not sure how you create your database handles (in a central
location then passed around, or in each handler as you need it), but
in MySQL (as with other databases) you can execute a 'use <dbname>' to
start using a different database.
So your definition can be the same for all virtual hosts but you can
define a variable via PerlSetVar or in a configuration file that has
the database name. When you ask for a database handle you can then
create it using a common database name (e.g, 'mysql') and then
execute the 'use <dbname>' statement:
Thanks a bunch - I never thought about using "use <dbname>" in a mod_perl/DBI context. It's obvious when you know it ;-).
--
Med venlig hilsen
-Toem
Tommy Davis, Technical Director
Adapt A/S, Havnegade 41, 2. sal, 1058 København K
Tel +45 3341 1050, Fax +45 3341 1069, http://www.adapt.dk/