Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify DB2 port number

Tags:

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.

like image 412
user628083 Avatar asked Nov 23 '11 13:11

user628083


People also ask

What ports does DB2 use?

As a server processing TCP/IP connection requests for DRDA SQL applications, Db2 uses a server port or the well-known port, 446, which is used for relational database communications.

What is the default port for DB2?

If enabled, the default DB2 instance will be assigned a default port of TCP:50000 for TCP/IP communication. TCP:50000 is a widely known DB2 port, so this port assignment should be changed.

What are DB2 commands?

The Db2 command line processor is a program that runs under z/OS UNIX System Services. You can use the Db2 command line processor to execute SQL statements, bind DBRMs that are stored in HFS files into packages, call stored procedures, and perform XML schema repository operations.


2 Answers

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.

like image 130
Ian Bjorhovde Avatar answered Sep 25 '22 11:09

Ian Bjorhovde


Go to DB2 command prompt.

Issue the command to get the db2 instance

Command : db2 get instance

Issue the command to find the TCP/IP service name

Command : db2 get dbm cfg | grep SVCE

Example

db2 get dbm cfg | grep SVCE

TCP/IP Service name (SVCENAME) = db2c_db2inst9 The TCP/IP service name is "db2c_db2inst9"

Use the TCP/IP service name to find the port number in the /etc/services file

Command : grep TCP/IPservicename /etc/services

Change TCP/IPservicename with the current service name.

Example

grep db2c_db2inst9 /etc/services

db2c_db2inst9 50090/tcp

The DB2 instance is running on the port number 50090

like image 21
Pradeep Padmarajaiah Avatar answered Sep 24 '22 11:09

Pradeep Padmarajaiah