If you want to access a remote DB2 (v9.7) database from another host that’s running DB2 client. You have to do following things on client machine:
- Adding remote host in host file
- Switch user to DB2 user (e.g. db2inst1)
- Catalog remote node
- Catalog remote database
Adding remote host in host file
Open /etc/hosts
file and add your remote host with it’s IP address. You can vi
this file and make changes. You must have root privileges to do this operation.
Switch to DB2 user
Switch to DB2 user by following command in shell.
su - db2inst1
Catalog remote node
Since now you have added you remote host in the host file (suppose your hostname is lpar0). Execute following command in the shell:
catalog tcpip node lpar0 remote lpar0 server 50000 50000 is the port of DB2 database.
Cataloging remote database
Now execute following command.
. DB2_INST_HOME/sqllib/db2profile catalog database mysampledb as mysampledb at node lpar0 authentication server
Check your connectivity
connect to mysampledb user ctginst1 using admin
Where ctginst1
and admin
are user name and password of mysampledb
on host lpar0
.
1 Comment