DB2 Federation between two DB2 databases

Two Databases
-----------------------

Step 1:

Go to db2 prompt
db2=>

Step 2 (Optional) Create database if necessary
create database Tom
create database Jerry

Step 3: Connect to DB1 and create table (Example Tom) (Optional)
connect to tom
create table db2inst1.tab1 (cod1 int)
insert into db2inst1.tab1 values (1)

Step 4: Connect to DB2 and create table (Example Jerry)
connect to jerry
create table db2inst1.tab2 (name1 char)
insert into db2inst1.tab2 values ('a')

Step 5: Create server and mappings in 1st DB (Tom) to access 2nd DB (Jerry)
connect to tom
create server fedserver TYPE DB2/UDB VERSION 10.5 WRAPPER drda  AUTHORIZATION "db2inst1" password "******" OPTIONS(DBNAME 'jerry')
create user mapping for db2inst1 SERVER fedserver OPTIONS(REMOTE_AUTHID 'db2inst1',REMOTE_PASSWORD '******')
create nickname mytable for fedserver.db2inst1.tab1

Step 6:
Executing Select statement from 1st Db (Tom) to query results from 2nd DB (Jerry)
select * from mytable

Popular posts from this blog

Shrink you container size up to 95%.

alma linux: dnf Module yaml error: Unexpected key in data