How can I tell what port my DB2 database is listening on?

Logon to the DB2 system as the DB2 user and run the following command:

db2 get dbm cfg | grep -i svcename

This will give you output like the following:

TCP/IP Service name (SVCENAME) = db2c_cdbinst1

Take the SVCENAME value and grep for it in the /etc/services file.


grep db2c_cdbinst1 /etc/services

This will give you the port.

db2c_cdbinst1 50005/tcp

In this case 50005.