Can't connect to IBM DB @ z/OS (Windows 10, IBM DB2 Connect Personal Edition, Python 3.6.4, ibm_db 2.0.8) SystemError: <built-in function connect> returned NULL without setting an error

1,043 views
Skip to first unread message

Laszlo Szolnoki

unread,
Jan 23, 2018, 10:26:13 PM1/23/18
to ibm_db
Hi,
I'm getting 'SystemError: <built-in function connect> returned NULL without setting an error' while trying to do this:

import ibm_db
ibm_db.connect("DATABASE=xxxx;HOSTNAME=xxx.xx.xx.x;PORT=446;PROTOCOL=TCPIP;UID=xxxx;PWD=xxxxxx;", "", "")

DB is up and running and I can connect to it via CLPPlus and via other means.
I read @ https://bugs.python.org/issue32527 that 'ibm_db is a third-party module. Please contact the authors of the module. The C code of the module has a bug. It's returning NULL without setting an exception with PyExc_*().'

My OS is Windows 10 Enterprise 64bit
I'm using Python 3.6.4 and ibm_db 2.0.8
I have IBM DB2 Connect Personal Edition Version 9.7 Fixpack 4 - 64 bit

Thanks for your support in advance.

Saba Kauser

unread,
Jan 23, 2018, 10:29:14 PM1/23/18
to ibm_db
Can you try the attached dll. replace your's in the installation of ibm_db with the one that is attached and let me know the results.
I have added few debug prints and shall remove them once you see it working.
ibm_db.cp36-win_amd64.pyd

Saba Kauser

unread,
Feb 19, 2018, 3:04:24 AM2/19/18
to ibm_db
Hello Laszlo,

Were you able to test.

Laszlo Szolnoki

unread,
Mar 6, 2018, 8:29:43 AM3/6/18
to ibm_db

Hi, Saba,
sorry for the late response.
Maybe I'm missing something but I didn't have the file ibm_db.cp36-win_amd64.pyd so I could not overwrite, I downloaded copies of the file that you provided to each of the following locations, instead:
C:\Users\xxxx\AppData\Local\Programs\Python\Python36
C:\Users\xxxx\AppData\Local\Programs\Python\Python36\DLLs
C:\Users\xxxx\AppData\Local\Programs\Python\Python36\Lib\site-packages\ibm_db-2.0.8-py3.6.egg\ibm_db_dlls
I am getting the same error.




Saba Kauser

unread,
Mar 6, 2018, 8:54:24 AM3/6/18
to ibm_db
Hello Laszlo,
Were you able to see additional debug statements while connecting?
the file can be renamed to ibm_db.pyd.

gygab...@gmail.com

unread,
Mar 18, 2018, 10:45:51 PM3/18/18
to ibm_db
I have the same problem, trying with your file the debug messages are:

Not a persistent connection. check for max connections. resued = 0
Allocate env handle
Connection attempted, but failed. Hence free env and dbc
connection
is in error with conn_res = 00000000022D4870
rc
is not success. Error message printed. Returning NULL. rc = -2
Traceback (most recent call last):
 
File "P:\Users\934334\Desktop\test_db2.py", line 3, in <module>
    conn
= ibm_db.connect("HOSTNAME=;PORT=;DATABASE=;UID=;PWD=;", "", "")
SystemError: <built-in function connect> returned NULL without setting an error



The script is simply:


import ibm_db


conn = ibm_db.connect("HOSTNAME=;PORT=;DATABASE=;UID=;PWD=;", "", "")


(I've removed connection info)


What can I do?

Reply all
Reply to author
Forward
0 new messages