RickInGarland
RickInGarland

Reputation: 103

Multiple DB2 databases in one connectionstring to compare test tables to prod via ODBC

Like I can do in Microsoft Access, I would like to link to 2 IBM DB2 databases in one query statement.

The only way I can figure out how to do it is to link to the first database, extract to a datatable, then do a ForEach-Object and query the second database.

$iSeriesAccount = "USSRF_ADM"
$iSeriesDSN = "DB2_MR0P"
$Db2Connection = New-Object System.Data.Odbc.OdbcConnection
$Db2Connection.ConnectionString = "DSN=$iSeriesDSN;" +
                                  "Userid=$iSeriesAccount;" +
                                  "Password=$iSeriesPassword"

Upvotes: 0

Views: 86

Answers (1)

Paul Vernon
Paul Vernon

Reputation: 3901

You could consider Federation in one of the databases so that you can use a single query in that database and access tables from both databases

https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.data.fluidquery.doc/topics/tlsdb201.html

Upvotes: 2

Related Questions