db2没有在localhost上侦听TCPIP连接

时间:2013-05-31 12:22:11

标签: db2 db2-luw

我无法将我的db2应用程序连接到我的localhost数据库。

应用程序使用的db2 API需要TCPIP并尝试连接到主机“localhost”和端口“50001”。

我遇到的错误是。

 SQL30081N  A communication error has been detected. 
 Communication protocol being used: 
 "TCP/IP".  Communication API being used: "SOCKETS".  Location where 
 the error was detected: "127.0.0.1".  Communication function detecting 
 the error: "connect".  Protocol speci    fic error code(s): "111", "*"
 , "*".  SQLSTATE=08001

我必须手动设置以下所有内容,因为我的机器上没有它

我查看了wireshark,看看发生了什么,但我可以看到使用telnet the communication is not established and netstat doesn't listen that port.

netstat


Do I have to issue some extra command to start listening?

Below all my setup.

db2 "get database manager configuration" | grep SVC
TCP/IP Service name                      (SVCENAME)     = db2c_db2inst1
SSL service name                         (SSL_SVCENAME) = 

Then the services

cat /etc/services | grep db2c_
db2c_db2inst1   50001/tcp       # DB2 connection service port

I also allow the firewall on that port.

重置通信。

1 个答案:

答案 0 :(得分:3)

步骤应该是:

  1. 设置DB2COMM=tcpip并退回实例

  2. 使用
    检查是tcpip4还是tcpip6 netstat -an | grep -i port number (here 50001)

  3. 使用
    获取远程服务器IP pctt -r

  4. 目录节点:
    db2 catalog tcpip4/tcpip6 node <nodename> remote <ip address> server <port number>

  5. 目录数据库
    db2 catalog DB <dbname> at node <nodename>