Monday, 1 December 2014

How to find the DB2 port and server name

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:
  1. Open the DB2 Control Center on the remote Windows server.
  2. Right-click one of the available instances for the local machine.
  3. Click Setup Communications.
  4. Click Properties. The port number is listed in the Properties window.

To locate the server name and port number in unix environments:
  1. Open a command prompt.
  2. Enter cd /usr/etc.
  3. Enter cat services.
  4. 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:
    1. Open a DB2 command prompt.
    2. At the DB2 command prompt, verify that you are on the correct instance:get instance
    3. DB2 will report the current instance.
    4. 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
    5. 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