<docbook><section><title>HowDoIIdentifyTheDB2ListeningPort</title><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Identify the DB2 Listening Port </bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Identify the DB2 database listening port on Windows</bridgehead>
<para>1.
 Login to the DB2 DBMS server.</para><para>2.
 Launch the DB2 Control Center.</para><para>3.
 Right-click the target instance.</para><para>4.
 Click Setup Communications.</para><para>5.
 The port number appears in the Properties window.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Identify the DB2 database listening port on Unix</bridgehead>
<para><emphasis>Method 1: <computeroutput>/etc/services</computeroutput> </emphasis></para><para>1.
 Login to the machine that hosts the DB2 DBMS.</para><para>2.
 vi the <computeroutput>/etc/services</computeroutput> file.</para><programlisting>vi /etc/services
</programlisting><para> 3.
 Locate the socket service associated with your target database.</para><para>4.
 Identify the port number associated with the socket service.</para><para><emphasis>Method 2: get instance </emphasis></para><para> 1.
 Login to the machine that hosts the DB2 DBMS.</para><para>2.
 su to your db2 instance owner.
 For example:</para><programlisting>su db2instance1
</programlisting><para>3.
 Execute the .profile associated with the db2 instance owner.
 For example:</para><programlisting>. ./.profile
</programlisting><para>4.
 cd into the $DB2INSTANCE/sqllib/bin directory.</para><programlisting>cd $DB2INSTANCE/sqllib/bin
</programlisting><para>5.
 Execute the db2 command.</para><programlisting>./db2
</programlisting><para>6.
 Use the <emphasis>get instance</emphasis> option to get the current instance name.</para><programlisting>get instance
</programlisting><para> 7.
 Use <emphasis>get dbm cfg</emphasis> command to identify the socket service name.</para><programlisting>get dbm cfg l grep SVCE    # Example uses an &quot;l&quot; instead of a pipe due to limitations in markup display. 
</programlisting><para> 8.
 Look for output similar to the following where db2inst64 is the service name:</para><programlisting>TCP/IP Service name          (SVCENAME) = db2inst64
</programlisting><para>9.
 Use the db2 interface to grep the /etc/services file for the service name listed above.
 For example:</para><programlisting>grep db2inst64 /etc/services
</programlisting><para>10.
 Look for output similar to the following:</para><programlisting>db2inst64   50012/tcp   # Connection port for DB2 instance instance
</programlisting></section></docbook>