I have to make DB2 connection in java using port number. Is there any command in DB2 or any way that can get the DB2 port number?
I have not used the default port 50000 while making DB2 connection as this port can be changed during DB2 installation. Please suggest any DB2 command or any other alternative.
On the Windows DB2 server, open a DB2 Command Window and execute the command
db2 get database manager configuration | findstr /i svce
This should provide some output like:
TCP/IP Service name (SVCENAME) = db2c_DB2
SSL service name (SSL_SVCENAME) =
SVCENAME is the port that DB2 is listening on. To resolve this name to an actual port number, you need to refer to the services file, which is located at %SystemRoot%\system32\drivers\etc\services
.