Wednesday, May 11, 2016

DB2 LUW - Connection refused. ERRORCODE=-4499, SQLSTATE=08001

Application developer says that he is not able to connect to the database, he's getting a message similar to this:
"Error opening socket to server /nnn.nnn.nnn.nnn on port 50,000 with message: Connection refused. ERRORCODE=-4499, SQLSTATE=08001"

How do you resolve it?


  • Get the TCP/IP service name: 
    • Issue this command: db2 get dbm cfg|grep -i svce
    • The output will be something like this:
    • TCP/IP Service name                          (SVCENAME) = svce_db2inst1
    •  
  • Verify the port number:
    • Issue this command: cat /etc/services|grep -i svce_db2inst1
    • The output will be something like this: svce_db2inst1   50000/tcp
    •  
  • Make sure the port is listening:
    • Issue this command: netstat -Aan|grep -i 50000
    • If you do not see any output, it means the port is not listening and that's a problem
  • If the port is not listening, check the db2set parameter:
    • Issue this command:  db2set
    • If you don't see a DB2COMM parameter, then it needs to be set for applications to communicate with DB2
    • Update the DB2COMM parameter with this command: db2set db2comm=TCPIP
    • Stop and restart the DB2 instance: db2stop and db2start 
  • After restarting DB2, check if the port is listening by issuing the command "netstat -Aan|grep -i 50000". If the port is listening, you'll see the output similar to this:
    • f1000e00057aebb8 tcp4       0      0  *.50000               *.*                   LISTEN
    • f1000e00054ddbb8 tcp4       0      0  nnn.nnn.nnn.nnn.50000   nnn.nnn.nnn.mmm 33xxx   ESTABLISHED
    • f1000e000b3653b8 tcp4       0      0  nnn.nnn.nnn.nnn.50000   nnn.nnn.nnn.mmm 33yyy   ESTABLISHED
HTH !!

No comments: