I am trying to connect to DB2 LUW. I am aware that if I catalog tcpip node and the database, I will be able to connect to the DB. Example:
db2 catalog tcpip node mynode remote 20.40.20.40 server 5555
db2 catalog database mydb as mydb at node mynode
db2 terminate
db2 connect to mydb user myuser using mypassword
However, if I may be required to connect to various DBs, does it mean that I HAVE TO undergo the catalog process every time there is a new DB involved? Or is there a way to connect without it? I did find this article from IBM KB, but it's for DB2 z/OS. Currently if I try the following syntax:
db2 connect to 20.40.20.40:5555/mydb user myuser using mypassword
I get an error:
SQL0104N An unexpected token "20.40.20.40:5555/mydb" was found following "TO". Expected tokens may include: "<database-alias>". SQLSTATE=42601
You can do this with CLPPlus, which is written in Java and therefore uses a JDBC driver:
clpplus myuser@20.40.20.40:5555/mydb
but not with the traditional CLP.