Gossamer Forum
Home : General : Perl Programming :

eval and db failover

Quote Reply
eval and db failover
Hi. I put this perl code in my application in order to switch automatically to the backup server if the primary server is down.

I found that the backup ip has been used many times even, if the primary was up and running Crazy

Can you evaluate this and let me know your ideas and/or experience in similar situations?



Code:


eval {

$db='DBI:mysql:database='.$db_name.';hostname='.$db_host;

my $dbh = DBI->connect($db,$db_user, $db_pass);

$dbh->disconnect;

};

if ($@) {

$db_host ="192.168.1.21";


...
Subject Author Views Date
Thread eval and db failover robyone 7738 Dec 3, 2003, 2:14 AM
Thread Re: [robyone] eval and db failover
Andy 7544 Dec 3, 2003, 2:24 AM
Thread Re: [Andy] eval and db failover
robyone 7570 Dec 3, 2003, 2:35 AM
Thread Re: [robyone] eval and db failover
Andy 7556 Dec 3, 2003, 2:45 AM
Thread Re: [Andy] eval and db failover
robyone 7627 Dec 3, 2003, 2:58 AM
Thread Re: [robyone] eval and db failover
Andy 7553 Dec 3, 2003, 3:00 AM
Post Re: [Andy] eval and db failover
robyone 7556 Dec 3, 2003, 3:09 AM