Welcome Guest, Not a member yet? Register   Sign In
Multiple DB connection - System get the wrong one
#1

[eluser]cinewbie81[/eluser]
Hi all,

I have 2 database connections as following:
Code:
$dbClient = $this->load->database('client', TRUE);
$dbServer = $this->load->database('server', TRUE);

I want to make sure if the system get the correct db connection or not, therefore here is my verification code:

$dbClient->query('show tables');
$dbServer->query('show tables')

both $dbClient and $dbServer will return me 'server' database tables ..
And when i load server database 1st then only client as following:
Code:
$dbServer = $this->load->database('server', TRUE);
$dbClient = $this->load->database('client', TRUE);

Now both $dbClient and $dbServer will return me 'client' database table ..

It seems to me that the system will get the last database it loaded as the connection. Any idea why ? Hope someone can help, thanks.


Messages In This Thread
Multiple DB connection - System get the wrong one - by El Forum - 10-29-2007, 04:01 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-30-2007, 12:44 PM
Multiple DB connection - System get the wrong one - by El Forum - 10-30-2007, 12:52 PM
Multiple DB connection - System get the wrong one - by El Forum - 10-30-2007, 07:12 PM
Multiple DB connection - System get the wrong one - by El Forum - 10-30-2007, 10:45 PM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 12:51 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 01:10 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 02:08 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 02:12 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 03:27 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 03:39 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 05:55 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 06:14 AM
Multiple DB connection - System get the wrong one - by El Forum - 10-31-2007, 07:19 PM
Multiple DB connection - System get the wrong one - by El Forum - 11-02-2007, 04:16 AM
Multiple DB connection - System get the wrong one - by El Forum - 11-02-2007, 04:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB