-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrorException when Connecting to Multiple Databases #255
Comments
Just to confirm: It sounds like they would be tables. In which case, you only need the one connection. |
Yes, they are separate databases. |
Please ensure that both of your database connections are setup properly in Config\Database. I just tried locally and it worked.
|
That's works. I tested it. However I got that error when I load the view. I see the backtrace: BASEPATH/Debug\Toolbar\Collectors\Database.php : 152 BASEPATH/Debug\Toolbar\View\toolbar.tpl.php : 49 APPPATH/Filters\DebugToolbar.php : 47 The problem is on that lines I guest. |
Thanks for pointing me in the right direction. The error happened because no queries had been run so far, so the database connection had not actually been initialized. So, it couldn't grab the version of the database when trying to display it in the toolbar. Fix to follow. |
You're welcome :-) |
I have two databases, and try to make multiple connections like this:
$blogDbUsers = \Config\Database::connect('users');
$blogDbBlogs = \Config\Database::connect('blogs');
Then, I got problem like this:
ErrorException
Trying to get property of non-object
BASEPATH/Database\MySQLi\Connection.php at line 280
The text was updated successfully, but these errors were encountered: