Below is the most common method to check the DB2 port and server name in different environments.
To locate the server name and port number on Windows:
- Open the DB2 Control Center on the remote Windows server.
- Right-click one of the available instances for the local machine.
- Click Setup Communications.
- Click Properties. The port number is listed in the Properties window.
To locate the server name and port number in unix environments:
- Open a command prompt.
- Enter cd /usr/etc.
- Enter cat services.
- Scroll through the list of services until you find the connection port number for the database instance of the remote database. The instance name is usually listed as a comment. If it is not listed, complete the following steps to find the port:
- Open a DB2 command prompt.
- At the DB2 command prompt, verify that you are on the correct instance:get instance
- DB2 will report the current instance.
- Run the following command to find the service name for your instance:get dbm cfg | grep SVCE
DB2 will report the service name. For example:TCP/IP Service name (SVCENAME) = db2cdb2inst24
- Use the service name to find the port number in the services file. For example, enter a command similar to this one:grep service_name /etc/services
DB2 will return the information. For example:service_name 50012/tcp # Connection port for DB2 instance instance