使用SSL的DB2连接问题。协议特定错误代码:“420”,SQLSTATE=08001

2024-10-01 19:24:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法使用Python建立到DB2数据库的SSL连接。我有服务器证书;arm文件(DigiCertGlobalRootCA.arm)。我可以使用Dbeaver和JDBC驱动程序通过db2jcc4.jar文件建立SSL连接,但我确实需要Python连接。谢谢你的提示

我正在使用port 31246,因为这是一个私有云实例

运行Python -V,我得到Python 3.7.0

运行db2level,我得到

DB21085I  Instance DB2 uses 64 bits and DB2 code release SQL09074 with
level identifier 08050107.
Informational tokens are DB2 v9.7.400.501, s110330, IP23238, and Fix Pack
4.
Product is installed at C:\PROGRA~1\IBM\SQLLIB with DB2 Copy Name DB2COPY1.

我的操作系统是Windows10企业版

我的代码没有在容器上运行

我对Dbeaver连接使用相同的主机名、端口、uid和pass

下面是我正在使用的连接字符串:String = "database=BLUDB;HOSTNAME=" + "hostname" + ";PORT=" + "31246" + ";PROTOCOL=TCPIP;UID=" + "userid" + ";PWD=" + "MyPass" + ";SECURITY=ssl;"+"SSLServerCertificate=C:/SSL/DigiCertGlobalRootCA.arm;"

下面是我得到的错误:

SQL30081N A communication error has been detected. Communication protocol
being used: "SSL". Communication API being used: "SOCKETS". Location where
the error was detected: "". Communication function detecting the error:
"sqlccSSLSocketSetup". Protocol specific error code(s): "420", "", "".
SQLSTATE=08001

Tags: and文件thesslwithcodeerrorused

热门问题