Welcome Guest, Not a member yet? Register   Sign In
Connect to alternate DB when default DB is down?
#4

[eluser]Randy Casburn[/eluser]
I'm thinking as I type, so...

If you're auto loading your DB, you could hook into a pre_controller routine that tests for the DB connection exactly as you've described above...so in code:

Code:
$this->load->database('local_group_name');
if ( ! this->db )
{
     $this->load->database('remote_group_name');
    
}

That is exactly what your code above does. In a pre_controller hook you could ensure your CI_DB object wouldn't have to change. In other words, you would be able to use $this->db to access the CI_DB object rather than separate names for separate connections.

Again, thinking as I'm typing, but this would achieve what you want as a temporary stop-gap.

Randy


Messages In This Thread
Connect to alternate DB when default DB is down? - by El Forum - 07-29-2008, 06:51 PM
Connect to alternate DB when default DB is down? - by El Forum - 07-29-2008, 07:17 PM
Connect to alternate DB when default DB is down? - by El Forum - 07-29-2008, 07:23 PM
Connect to alternate DB when default DB is down? - by El Forum - 07-29-2008, 08:03 PM
Connect to alternate DB when default DB is down? - by El Forum - 07-30-2008, 05:22 PM
Connect to alternate DB when default DB is down? - by El Forum - 07-30-2008, 06:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB