Solved: I was connecting to the wrong port, according to /etc/services | grep db2

I have a DB2 Express C v.10.5 database running on localhost, but simply I can't connect to it.

Translation of the error message below: "java.net.ConnectException: An error occured when opening the socket to the server ... on port 50000 with message: Connection refused" Connection error dialog

Driver properties: driver properties

I am using DBeaver 3.1.1, Ubuntu 14.04 LTS 64 bit.

Can somebody please help? :|


First make sure db2 is started:

#> db2 connect to <db>

If that's not ok, use db2start. Next what port is db2 listening to?

#> cat /etc/services | grep db2

If it's not 50000 change your connections string in DBeaver. Next try to telnet to the port (assuming it is 50000):

#> telnet localhost 50000

If that's fine (saying something like Escape charater is ^]), check if DB2COMM is set:

#> db2set | grep DB2COMM

It should say DB2COMM=TCPIP

Is it a firewall issue? Check with:

#> sudo iptables -L
  • Thank you a lot :) Instance of that DB was currently running on port 50001, not 50000
    – benik
    Dec 27 '14 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.