IP Addresses of Database Connections

Ever needed to track down those pesky connections to a database you’re trying to backup?

No idea how to work out who is constantly connected to a database via Command Centre?

Well, below is a simple guide to finding out where those database connections originate from by converting the application handle from the list applications command to an ip address.

Suppose you’ve just run a db2 list applications for database sampledb and get the following output: –

Auth       Application    Appl.      Application Id                       

Id           Name            Handle                                            

user01   db2bp.exe     354        J66D5F7E.ID08.025CC3135357      

user02   javaw.exe      66         J66C89C5.D40D.023443140109    

 

 If you want to determine the ip address for user01, then follow the steps below: –

1.   Take the first part of the Application Id as the ip address and the second part as the port number.

      For user01 this will result in

      ip address = J66D5F7E

      port number = ID08

 

 2.   If the first character of either the ip address or port number is a value anything other than A,B,C,D,E or F then this needs to be converted as follows: –

      G = 0, H = 1, I = 2, J = 3, K = 4, L = 5, M = 6, N = 7, O = 8, P = 9

      For user01 we now have

      ip address = 366D5F7E

      port number = 2D08

 

 3.   Break the ip address into two character hex values and convert to decimal

      36  6D  5F  7E

      36 = 54

      6D = 109

      5F = 95

      7E = 126

      ip address = 54.109.95.126

  

4.   Finally convert the port number from hex to decimal

      2D08 = 11528

 

So for user01 the originating address is

      ip address = 54.109.95.126

      port number = 11528

 

 Following the same steps the address for user02 would be: –

      ip address = 54.108.137.197

      port number = 54285

 

Share
This entry was posted in DB2, Paul Stoker, Techie Tips and tagged , , . Bookmark the permalink.