Query two database

Query two database

Postby dooh » Tue 23 Dec 2008 20:12

Hi,

Is possible with MySQLDirect 3.5 query two databases?

Thanks
dooh
 
Posts: 30
Joined: Sun 14 Jan 2007 21:11

Postby Shalex » Wed 24 Dec 2008 09:47

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).
Shalex
Devart Team
 
Posts: 7378
Joined: Thu 14 Aug 2008 12:44

Postby dooh » Thu 25 Dec 2008 09:07

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
dooh
 
Posts: 30
Joined: Sun 14 Jan 2007 21:11

Postby Shalex » Thu 25 Dec 2008 12:11

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.
Shalex
Devart Team
 
Posts: 7378
Joined: Thu 14 Aug 2008 12:44

Postby dooh » Thu 25 Dec 2008 18:42

Thanks

Shalex
dooh
 
Posts: 30
Joined: Sun 14 Jan 2007 21:11


Return to dotConnect for MySQL