DB2 9.7 seems to have brought back an old problem: DB2 servers that are deaf to TCP/IP connections. In today’s action, my JDBC connections on a new Windows DB2 9.7 configuration were hanging for several minutes and then eventually failing with a “connection refused” error. Since such problems are usually due to configuring the wrong port, I verified it:
db2 get dbm cfg | find “SVC”
type %WINDIR%\system32\drivers\etc\services | find /i “db2”
I had specified the right port: the standard 50000 default for the first instance. And all the standard DB2 tools connected to the database just fine, including CLP and CLI connections. After checking all the wrong places, I finally looked to see if DB2 was actually listening on this port:
netstat -an | find “500”
telnet localhost 50000
It wasn’t: I got no relevant matches on the netstat and telnet gave the “connect failed” error. I checked DB2COMM and found it didn’t include TCP/IP. Weird. So I quickly remedied that with:
db2set DB2COMM=tcpip & db2stop & db2start
And verified with:
db2set -all db2comm
I’m not sure why some recent new DB2 9.7 installs didn’t have TCP/IP connections enabled by default. Usually, it’s the setup/db2setup default. But it’s something I’ll watch for, with a quick solution next time.