-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ibm_db.callprocedure throwing UnicodeDecodeError: 'utf-8' codec can't decode byte #924
Comments
@jthyssenrocket Please have your comment on this issue. It seems upgrade to python 3.11.5 on z/OS is causing |
I don't have IBM Python 3.11.5, but @c-muncan's programs run fine for me with Python 3.11.4 + ibm_db 3.2.0. |
Thanks for checking @jthyssenrocket. If you have a PAX install of 3.11.4 handy, I'd love that. I've asked our systems folks to see if we can install 3.11.4 or to provide me with the installs so I can install it on our zDT ADCD environment. Presently it is working in our ADCD environment, but there we have Python 3.11.0 + ibm_db 3.2.0 |
no luck on 3.11.4. we ordered from ShopZ so we get the latest and greatest. can't pick the version you want. |
@Earammak not sure if you maybe had a chance to look further into this? Any advice from anyone? it is a huge show stopper for us |
Hello @c-muncan
Also in your .profile file try to set
Please refer the below link to install ibm_db on zos and try to set all the environment variables properly Also you can upgrade your ibm_db from 3.2.0 to 3.2.3 and try. Thank you |
I found the problem! My issue was 2-fold. First, I updated encoding scheme from EBCDIC to UNICODE as per @bchoudhary6415 This then actually output an error message. It turns out, it was a -805 reason code 03 (no matching dbrm) for package DSNCLIMS. I went to bind the package as per DSNTIJCL but was getting -189 explicitly for DSNCLIMS. This is apparently a known issue and has its own KB https://www.ibm.com/support/pages/sqlcode189-rebind-package-dsnaoclidsnclims Bind with SQLERROR(CONTINUE) to bypass this error. I did that and then magically everything was working!!! Just an FYI, in my ADCD environment, I did not have to do any of this, in fact, my CURRENTAPPENCH is set to EBCDIC. Thank you @jthyssenrocket, @bchoudhary6415 & @bimalkjha ... this saved our project! |
@c-muncan I think the root cause for the error message is the missing bind. We have a known issue with error messages sometimes being returned in an unexpected code page (see #876 (comment)). This issue is still unresolved (CC @bchoudhary6415 ). Can you retry with CURRENTAPPENCH=ASCII after having done the missing bind? It should work... |
@jthyssenrocket yes it does work using |
Unfortunately, we inconsistently use the regular ODBC APIs which are affected by CURRENTAPPENSCH and the "W" (wide, UTF-16) ODBC APIs which are not affected by CURRENTAPPENSCH. Where we use the regular APIs we implicitly assume that ODBC returns ASCII, so I strongly recommend CURRENTAPPENSCH=ASCII. For a North American customer it probably doesn't matter if you're using UNICODE (UTF-8) or ASCII. We have an internal requirement open to switch to consistently use of the ODBC "W" (UTF-16) APIs, but it is a large development item, so no delivery date at this point. Reference: https://www.ibm.com/docs/en/db2-for-zos/13?topic=data-db2-odbc-unicode-support. |
Package Version
cffi 1.14.6
cryptography 3.3.2
dateutils 0.6.12
ebcdic 1.1.1
ibm-db 3.2.0
numpy 1.23.4.post0
pandas 1.5.1.post3
pip 23.2.1
pycparser 2.20
python-dateutil 2.8.2
pytz 2022.4
regex 2023.6.3
setuptools 65.6.3
six 1.16.0
XlsxWriter 3.1.2
zoautil-py 1.2.3
zos-util 1.0.1
uname
OS/390
uname -m
8562
IBM_DB_HOME=SFDB.DSN124
PATH=/bin:/usr/lpp/Printsrv/bin:/usr/lpp/java/current_31/bin:/usr/lpp/ixm/IBM/xml4c-5_7/bin:/usr/lpp/IBM/zoautil/bin:/usr/lpp/Rocket/rsusr/ported/bin:/usr/lpp/c
yp/v3r11/pyz/bin:.
CLASSPATH=.:/usr/lpp/mqm:/usr/lpp/smp/classes:/usr/lpp/IBM/zoautil/lib
LIBPATH=/lib:/usr/lib:/usr/lpp/mqm/:/usr/lpp/Printsrv/lib:/usr/lpp/ixm/IBM/xml4c-5_7/lib:/usr/lpp/IBM/zoautil/lib:/usr/lpp/Rocket/rsusr/ported/lib:/usr/lpp/cyp/
v3r11/pyz/lib:.
_CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)
DSNAOINI=/u/a463/odbc_tst1.ini
ls -laT $DSNAOINI
b binary T=off -rw-r----- 1 A463 USSDFTG 209 Apr 1 14:20 odbc_tst1.ini
file contents
I am having errors for a few of the functions. I don't get this in my mainframe zDT ADCD environment. We are just rolling out Python and I'm having these new issues in this environment which I didn't have before.
ibm_db.tables sample code
output
fetch_both works just fine. so does field_name, but callprocedure seems to be failing me always. I've even tried other scripts which yield similar results.
db2util.py
output
db2zparm.py
output
ultimately it seems to fail whenever calling a stored procedure.
now this does look similar to #852 but I've confirmed my settings quite a fair bit too and am fairly confident it isn't the same problem.
I captured the trace output by updating my ini file to include
It generated a lovely file called "DD:DSNAOTRC" in the directory where I ran my script. ran
./dsnao64t fmt DD\:DSNAOTRC trace.txt
C-MuncanDb2Trace.txt
set |grep BPX;set |grep CEE;set |grep STEPLIB;set |grep TAG;set |grep DSNAOINI
please take a look and let me know if there's anything else I'm missing?
The text was updated successfully, but these errors were encountered: