Error in Connection with two different DB
Moderator: General Moderators
-
logeshkumartk
- Forum Newbie
- Posts: 2
- Joined: Sun Apr 12, 2015 7:58 am
Error in Connection with two different DB
I'm working on Laravel project, when im using joins with two different database (ie) [different username and password for both the database], it throws an error stating that one database username can't be used to connect with other database. can anyone please tell me how to use two different database with joins in laravel.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Error in Connection with two different DB
I don't know about Laravel, but you need to prefix the table names with the database names in the format dbname.tablename.
(#10850)
-
logeshkumartk
- Forum Newbie
- Posts: 2
- Joined: Sun Apr 12, 2015 7:58 am
Re: Error in Connection with two different DB
even if i use db name as prefix connection error will occur because db username and password are different
Re: Error in Connection with two different DB
You can't use two different connections for one query. Pick one connection and do the query with that.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Error in Connection with two different DB
Yes. And remember that the database user must have SELECT privileges for both databases.
(#10850)