Showing posts with label url. Show all posts
Showing posts with label url. Show all posts

Thursday, August 4, 2016

How to find the database connection strings?

To find the database connection strings such as url, port number etc:

Database URL can be found using the command ifconfig -a.

en1: flags=xxxxx,480
        inet xxx.xxx.xx.xx netmask 0xffffff00 broadcast xxx.xxx.xx.xx
         tcp_sendspace 12345 tcp_recvspace 12345 rfc1323 1
en2: flags=xxxxx,480
        inet xxx.xxx.xx.xx netmask 0xffffff00 broadcast xxx.xxx.xx.xx
         tcp_sendspace 12345 tcp_recvspace 12345 rfc1323 1
lo0: flags=xxxxx,c0
        inet xxx.xxx.xx.xx netmask 0xff000000 broadcast xxx.xxx.xx.xx
         tcp_sendspace 12345 tcp_recvspace 12345 rfc1323 1


Port number can be found using these steps:

  • db2 get dbm cfg|grep -i svcename
    •  TCP/IP Service name                          (SVCENAME) = db2_db2inst1

  • Search for the svcename value in /etc/services file (cat /etc/services|grep -i db2_db2inst1)
    • db2_db2inst1   50000/tcp 

  • Check if the port is listening
    • netstat -Aan|grep -i 50000