I am looking for a solution to the problem described below.
There are two DB2 instances with two authorization IDs on the same server and can be accessed using the same user User1.
To access Inst1DB, I use the following commands:
[User1 ~]$ . /db2/authID1db2/home/authID1db2/sqllib/db2profile [User1 ~]$ db2 connect to Inst1DB
To access Inst2DB, run the following commands:
[User1 ~]$ . /db2/auth2db2/home/auth2db2/sqllib/db2profile [User1 ~]$ db2 connect to Inst2DB
Note that one needs to terminate the current DB2 session before connecting to another DB instance. To terminate DB session, run the following command:
[User1 ~]$ db2 terminate
I want to join two tables, one of which belongs to INST1DB and the other to INST2DB, while connected to INST1DB.
[User1 ~]$ . /db2/authID1db2/home/authID1db2/sqllib/db2profile [User1 ~]$ db2 connect to Inst1DB [User1 ~]$ db2 "Select * from Inst1DB.schema1.table1 T1 , Inst2DB.schema2.table2 T2 where T1.column1 = T2.column1.
Curerntly I am getting below error:
SQL0204N "Inst2DB.schema2.table2" is an undefined name. SQLSTATE=42704.
Can anyone suggest to me how to connect the two instances and perform a join on these tables?