3

我无法将我的 db2 应用程序连接到我的本地主机数据库。

应用程序使用的 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看发生了什么,但我可以看到通信已重置..plus使用telnet the communication is not established and netstat doesn't listen that port.

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.

 iptables -I INPUT -p tcp --dport 50001 -j ACCEPT  
 /sbin/service iptables save

 iptables -list

 Chain INPUT (policy ACCEPT)
 target     prot opt source               destination         
 ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:db2c_db2inst1 
4

1 回答 1

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>

于 2013-10-10T16:40:58.460 回答