> Hi all,
>
> If this is the case, I assume I'm going to have to update the two
> applications so that they use unique variable names for every DBI handler
> (especially since the databases they consult have parallel structures with
> identical table names-I don't want one application mucking with the
> other application's database).

What I have done in similar situations is to put the database handles in a
hash/hashref, keyed on either the database/server name or something else
that make sense in the context.   For instance you could have
$dbh{production}, $dbh{staging}, and $dbh{test}; there is very little
chance for confusion because you are referring to each instance explicitly
by name.

>
> Does this make sense? Am I overlooking anything?
>

I would suggest using different usernames and passwords on the databases;
this will help prevent one potential cause of confusion and accidential
cross-contamination.   If you try to connect to the wrong database, you'll
get an error.   You might also want to have a single-row table in each
instance of the database that unambiguously identifies it to the
application.  EG:

my ($instance_id) = $dbh{production}->selectrow_array(
    'select instance_id from instance'
);
die 'wrong db!' unless $instance_id eq 'production';



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to