使用Python ibm_db连接DB2数据库时遭遇GSKit Error:17(SQL1109N/SQLSTATE=42724)错误的求助
使用Python ibm_db连接DB2数据库时遭遇GSKit Error:17(SQL1109N/SQLSTATE=42724)错误的求助
大家好,我在尝试用Python的ibm_db API连接DB2数据库时碰到了个棘手的问题,折腾好一阵都没解决,想请各位大佬帮忙分析下原因。
我遇到的错误信息如下:
Connection failed: [IBM][CLI Driver] SQL1109N The command was not processed because the database manager failed to load the following DLL: "GSKit Error: 17". SQLSTATE=42724 SQLCODE=-1109
以下是我写的连接代码:
import os os.add_dll_directory(r'C:\Users\x\AppData\Roaming\Python\Python313\site-packages\clidriver\bin') import ibm_db import ibm_db_sa conn_str = ( "DATABASE=x;" "HOSTNAME=x;" "PORT=50001;" "PROTOCOL=TCPIP;" "UID=x;" "PWD=x;" "SECURITY=SSL;" "SSLServerCertificate=C:\\cert\\db2cert\\xprdb2watom1_cacerts" ) try: conn = ibm_db.connect(conn_str, "", "") print("Connection successful!") except Exception as e: print(f"Connection failed: {e}")
我已经尝试把clidriver的bin目录添加到DLL搜索路径里,也正确指定了SSL证书文件,但还是触发了这个GSKit相关的加载错误。有没有朋友遇到过类似的情况,或者能指出我代码里可能存在的问题?
备注:内容来源于stack exchange,提问作者Naveen Kumar
相关产品推荐
相关产品推荐

