简体   繁体   中英

How to connect to Informix database using Python Package - ibm_db

I am trying to connect to Informix database using Python package ibm_db but am getting the below error.

Error:

builtins.Exception: [IBM][CLI Driver] SQL0902C A system error occurred. Subsequent SQL statements cannot be processed. IBM software support reason code: "". SQLSTATE=58005 SQLCODE=-902

Code:

import sys
import ibm_db
import ibm_db_dbi
import pyodbc
import subprocess
import os
import string
import pandas



try:
       conn= ibm_db.connect("HOSTNAME=xxxxxx;PORT=1900;PROTOCOL=onsoctcp ;DATABASE=webrpt; INSTANCE=vec_sandbox;UID=xxxx;PWD=xxxx","","")

except:
       print ("Transaction couldn't be completed:" , ibm_db.stmt_errormsg())
else:
       print ("Transaction complete.")

I was able to connect using Pyodbc package and installing client SDK on the Linux maching and configuring /etc/odbc.ini , /etc/odbcinst.ini and /app/informix/etc/sqlhosts files.

thanks!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM