Carlson, John W. wrote:
> What's the best method to support multiple similar databases with the same 
> code base? 
Depends on your architecture and what you're trying to accomplish .  

When I have multiple sites on the same server running the same code with
different database backends, I'll make global hash of database handles,
keyed on something like $ENV{HTTP_HOST}.   Then in each site's
syshandler I'll have something like:

    my $dbh = $serverwide::global_dbh{$ENV{HTTP_HOST}};

Then the rest of my code can just refer to $dbh as the database handle
and it will be pointing to the right db.

> I create versions of the code with symbolic links now.
>   
Nothing necessarily wrong with that
> Where's the best place to put database passwords?  
I usually use XML::Simple and put them in a xml file that's read into a
%config hash on start-up.  It's easy and self-documenting (assuming you
use meaningful key names).

> Should I create a web service that serves the database?
>   
Depends on your architecture, security requirements, scalability needs,
etc.   Probably not: additional layers = additional overhead =
additional code to maintain.
> John
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>   


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to