Page 1 of 1

Error in Connection with two different DB

Posted: Sun Apr 12, 2015 8:01 am
by logeshkumartk
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.

Re: Error in Connection with two different DB

Posted: Sun Apr 12, 2015 12:17 pm
by Christopher
I don't know about Laravel, but you need to prefix the table names with the database names in the format dbname.tablename.

Re: Error in Connection with two different DB

Posted: Sun Apr 12, 2015 11:21 pm
by logeshkumartk
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

Posted: Mon Apr 13, 2015 12:27 am
by requinix
You can't use two different connections for one query. Pick one connection and do the query with that.

Re: Error in Connection with two different DB

Posted: Mon Apr 13, 2015 11:50 am
by Christopher
Yes. And remember that the database user must have SELECT privileges for both databases.