Page 1 of 1

Query two database

Posted: Tue 23 Dec 2008 20:12
by dooh
Hi,

Is possible with MySQLDirect 3.5 query two databases?

Thanks

Posted: Wed 24 Dec 2008 09:47
by Shalex
You can do it in several ways: either using two separate MySqlConnection objects for every database, or with one MySqlConnection object (in this case you need to call the ChangeDatabase() method to switch between your databases).

Posted: Thu 25 Dec 2008 09:07
by dooh
maybe my question was not clearly, i mean:

In the same stament query two databases.

Ex:

SELECT db1.tb1.field1, db2.tb1.field2
FROM db1.tb1, db2.tb1.field2

Posted: Thu 25 Dec 2008 12:11
by Shalex
Yes, this functionality is available. You can execute such query:

Code: Select all

SELECT db1.tb1.field1, db2.tb1.field2
FROM db1.tb1, db2.tb1;
db1 and db2 must be located at the same host.

Posted: Thu 25 Dec 2008 18:42
by dooh
Thanks

Shalex