Query using 2 different database with 2 different host ?

How do you make query with 2 different database and 2 different host ?

You can set two different connections. Problem is that you cannot create a sql query over two different databases. So you have to find a workaround which might be dependent on your database. Sometimes you can merge the two databases to one pool, sometimes you need to do your query and store result as a temp table in your other db. It depends.

I don’t know if this one is bug or not, but i managed to query using 2 databse in the same server using [database_name].table_name.

But yes, the real problem when the databse in the different server.

Thanks albert

If the database is on a different server you can always make a federated table (mysql only). Other databases usually have simialr solutions. See http://en.wikipedia.org/wiki/MySQL_Federated

Nice info rr,

But using federated table, we need to create an identical table in the local and remote server. I don’t see this one is the solution since the database hierarchy i design is :

  • database_master on host A
  • database_company_transaction on host B
  • database_company_transaction on host C

Any other idea ?

If it is three times the same database structure then I dont really see the problem. Apart from that I would make 3 windows one for each database…
But I guess I dont have enough info to conclude that…
The data is not replicated I thought that that was what you wanted.

[QUOTE=rr;22490]If it is three times the same database structure then I dont really see the problem. Apart from that I would make 3 windows one for each database…
But I guess I dont have enough info to conclude that…
The data is not replicated I thought that that was what you wanted.[/QUOTE]

The problem is when we do query, because the master data / information is in different host.

what if you want to connect to a completely different database from the one .

Onilne Casino australia