Is it possible to query two separate oracle databases with one call?

  • Thread starter Thread starter Burak
  • Start date Start date
B

Burak

Hello,

Is it possible to join two tables on two separate oracle databases?

I would like to have two connections to two databases and execute a
query joining two tables in each db.

Dim connString1 As String = "Data Source=ds1;etc.."
Dim connString2 As String = "Data Source=ds2;etc.."

Dim conn As New System.Data.OracleClient.OracleConnection(connString1)
Dim conn2 As New System.Data.OracleClient.OracleConnection(connString2)

Is this possible?

Thanks,

Burak
 
I guess .. another way to put your question would be - can an "IDBCommand"
be associated with Two "Connection" objects? The answer is NO - but that
isn't the end of the world. (Read on).

The cross-query feature is more of a database feature more than anything.
You will have to link the databases together and then execute the query AS
IF it were running on one database.

If you however wanted to do this in ADO.NET instead, you could run two
queries, create two datatables, and then using datarelations join them
together somehow - create dataviews etc. However be aware that you are
moving around a greater amount of data than might be required. The correct
strategy you pick will depend on your needs frankly.

Looking at your code below, it seems to point more towards approach b) which
will work .. but isn't a cross database query in puristic dba terms.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/
 
Back
Top