Closed infoakash closed 3 years ago
Please use the version 3.0.2 of the ibm_db , and retry. You also need to tell us which Db2-server platform you try to reach (is it Db2 on Z/OS, Db2 for i-series, or Db2 for Linux/Unix/Windows) as different software driver for Db2 might be necessary if accessing Db2-for-i-series. You should also describe your workstation environment, is it MS-Windows or Linux etc, and how it is configured for python (virtual env etc?), and whether you have verified that this workstation can connect to the same database with the same credentials outside of python (for example, at the shell command line etc).
It's DB2 Z/OS I'm trying to connect to. Using Windows 10.
Upgraded to ibm_db 3.0.2 as well. Still getting the same error.
@SabaKauser is this something you can help with?
I read a couple of forums on this issue no plausible resolution is posted anywhere.
HI @infoakash
Can you please provide a bit more details and I can have a look into the issue.
Please provide me the details and I will try to reproduce the same and same check.
Hi @amukherjee28 ,
1.Script: import ibm_db conn_str = 'database=;hostname=;port=;protocol=tcpip;uid=;pwd=' #removed properties conn = ibm_db.connect(conn_str)
conn = ibm_db.connect(conn_str,'','') All what I am getting in the console is : Traceback (most recent call last): File "", line 1, in
SystemError: [built-in function connect] returned NULL without setting an error
Not getting anything written back by ibm_db. conn_errormsg() as well.
And I have got the DB2 connect license file placed in the license folder inside clidriver.
Have you verified that in a cmd.exe window on Win10, that you are able to use the db2cli.exe
(which is part of the clidriver) to connect to the Db2-for-Z/OS database successfully at the command line?
The idea is to prove that the clidriver can connect with the same credentials to the same database , regardless of python. This is often the way to find underlying errors and omissions in the configuration.
Once you get a successful connection using db2cli.exe validate -dsn YOURDSN -connect -user XXX -password YYY
, it means that your Win10 configuration for clidriver is all good, and your python ibm_db will then connect.
To help with this, You can configure the plain xml text file called db2dsdriver.cfg
file (in the clidriver\cfg directory , whose path is shown via pip show ibm_db
) with all the details of your Db2-for-Z/OS data-source (as instructed via the links on the Db2-documentation page here:
If that is too difficult for you , you can also run a CLI trace, with the db2trc
command (detailed in the Db2 Knowledge centre) with these command lines:
cd clidriver install path, found with pip show ibm_db
in Location: field of its output.
cd clidriver\bin
db2trc on -f trc.dmp
--> now run your application
db2trc off
db2trc flw trc.dmp trc.flw
db2trc fmt trc.dmp trc.fmt
db2trc fmt -c trc.dmp trc.fmtc
db2trc fmt -cli trc.dmp trc.cli
and share these files trc.flw, trc.fmt, trc.fmtc and trc.cli files
I see that other users reported this symptom in environments where they do NOT have local-administrator privilege, and others in corporate environment where the Windows workstation has specific ACLs that restrict the behaviour in some way.
So three additional suggestions:
python -m pdb YOUR_SCRIPT.py
and report its output.Hi Akash(@infoakash ), Does this resolve your issue? If yes, kindly close the issue else let us know if you need further help from us.
closing on this issue.
this issue still alive. im tryin to connect but had the same error
dsn = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=IASP01;HOSTNAME=192.168.0.1;PORT=50000;PROTOCOL=TCPIP;UID=USER;PWD=PASSWORD;"
ibm_db.connect(dsn, "", "")
and this command db2cli.exe validate -dsn YOURDSN
worked for me
@alessandroToninelli Can you please share the details that are mentioned from the issue template. You can also refer the similar issues: #783, #714, #692
Thanks
I'm trying to connect to db2 with ibmdb library. Using python 3.7.6 and ibm_db==3.0.1
import ibm_db conn_str = 'database=;hostname=.cua.com.au;port=;protocol=tcpip;uid=;pwd='
removed the details from conn_str
db2Conn = ibm_db.connect(conn_str, '', '')
while executing the connect this runs into a error : SystemError: returned NULL without setting an error