in reply to Re: DBI and Database Failover?
in thread DBI and Database Failover?

wouldn't it be possible to check the return value of connect and if it fails send another connect string?

Replies are listed 'Best First'.
Re^3: DBI and Database Failover?
by mr_mischief (Monsignor) on Nov 04, 2008 at 22:21 UTC
    Yes, that's possible. The solution JavaFan mentions is a very nice way to handle the situation, but is not stricly necessary.

    There are also the DBD::Multi, DBIx::HA, and DBD::Multiplex modules, each of which takes a slightly different application-level approach to easing the use of multiple database servers.

Re^3: DBI and Database Failover?
by JavaFan (Canon) on Nov 04, 2008 at 22:45 UTC
    Mja, that's possible. Not the way I'd set up things. But I'm confused, your question isn't "In Java I can check the return value of connect, and send another connect string if it fails, but I cannot do that in Perl", is it? In your original question, you said your Perl application was connecting to the same server, and I said that if set up properly, it should indeed connect to the same address - with the cluster taking care of moving addresses around.
Re^3: DBI and Database Failover?
by lostjimmy (Chaplain) on Nov 05, 2008 at 03:19 UTC

    It is certainly possible to do this. I speculate that the problem that tohann may be having is that his script is dying on the first call to connect. This would either be because the RaiseError attribute is turned on, or because there is an or die after the connect call.

    It would be nice to see some code.