无法将 zOS DB2 连接到 python ibm_db

Not able to connect zOS DB2 with python ibm_db

我无法使用 python ibm db 包连接到远程 zOS DB2。 连接时出现以下错误:

: [IBM][CLI Driver] SQL30081N  A communication error has been detected.
Communication protocol being used: "TCP/IP".
Communication API being use d: "SOCKETS".
Location where the be error was detected: "HOSTNAME".
Communication function detecting the error: "recv".
Protocol specific error code(s): "104", "*", "0".  SQLSTATE=08001`

如何解决这个错误?

刚刚添加的防火墙是打开的。 Telnet 和 openssl 工作正常。

我不知道你是怎么连接的。请尝试以下操作以帮助我们了解您来自哪里:

import ibm_db
ibm_db.connect("DATABASE=;HOSTNAME=;PORT=;PROTOCOL=TCPIP;UID=;PWD=;", "", "")

我可以使用以下连接字符串连接到远程 zOS DB2:

进口ibm_db

ibm_db.connect("Security=SSL;database=dbname;hostname=hostip;port=port;Protocol=TCPIP;SSLClientKeystoredb=pathtothekeystoredbfile(file extension.kdb);SSLClientKeystash=pathtothekeystashfile(file extension.sth);uid=userid;pwd=password", "", "")

此外,我不得不将许可证文件 "db2consv_zs.lic" 放到 ibm_db 的 LICENSE 文件夹中。