pythonpython-3.xdb2

Facing GSKit Error: 17". SQLSTATE=42724 SQLCODE=-1109 Error While Connecting from Python to IDB DB2


I am Trying to Connect DB2 Data base from Python program using ibm_db api. But i am getting below issue...

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

Below is my code...

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}")

Solution

  • The Actual Issue was on the certificate file , I was using the certificate which i have being used to connect from dbeaver , the cert file .crt file to be used for python was different