CakePHP Database.php notes when using 2 or more databases

If you will be using two or more database in your CakePHP webapp.  Be sure to take note of this.

In your database.php if you have more than one database setting be sure

to use different user accounts in each database to avoid problems because

in PHP if you are using the same account in accessing different database in the same server,

PHP will reuse the connection.  Thanks to AD7six for the info. 🙂

The problem I encountered was when I was using two database on the same server so I used same account for the two database.


Database1 . Table1   (Default DB to be used automatically by Cake)

Database2 . Table2

Now this two tables were associated,  I made a query to Table2 then I queried Table1 thats when the problem occured cake tried to query using Database2.Table1 which the correct location would be Database1.Table1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: