This article describes how to connect to the server from a client in the DB2 database for your reference.
When you access a database on the server from a client in DB2, you cannot directly use the connect command. Instead, you must first establish a communication node and then establish a database connection based on the node. The specific operations on the command line are as follows:
-> Db2 catalog tcpip node ABC remote serverName server 50000
-> Db2 catalog db databaseName at node ABC
-> Db2 connect to databaseName user Uid using Pwd
Note:
ABC in catalog tcpip node ABC is the name of a node you can start from. The name cannot be repeated with the existing name.
ABC in catalog db databaseName at node ABC refers to the name you mentioned earlier.
ServerName server name (remote database)
DatabaseName Database Name
Uid Username
Pwd Password
In addition, if the client has already established a node with the same server, if you want to connect to another database on the server, you do not need to create another node and use the same node directly. In addition, the port after the server name is not necessarily 50000 when the node is created, depending on the Database Engineer's current settings.
Related commands:
List db directory list accessible db
List node directory list Accessible Nodes
Other important DB2 commands
1. view the local node directory
In the command window, enter db2 list node directory.
2. cataloguing a TCP/IP Node
Command window: db2 catalog tcpip node <node_name> remote
3. Cancel node Cataloguing
Db2 uncatalog node <node_name>