Skip to content

ibm_db_dbi Exception is not getting captured on Type2 Connection. #1007

@Manojkumarbyibm

Description

@Manojkumarbyibm

Version:
ibm-db == 3.1.4
Db2 for z/OS = v13

Description:

ibm_db_dbi Exception SQLSTATE=42601 SQLCODE=-104 is not getting captured on z/OS Type2 connection.
Please exception message received from Type 4 & Type 2 connection below .

**Linux,Windows & Unix( Type 4 Connection) **:
23:50:07 - root - ERROR - Sql Error for <function Workload.run..insert_runner at 0x00000249512D3E50> thread 0 iteration 7 : ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "S" was found following "AT YEAR YEARS MONTH MONTHS DAY DAYS HOUR HOURS MINUTE MINUTES". Expected tokens may include: "AT YEAR YEARS MONTH MONTHS DAY DAYS HOUR HOURS MINUTE MINUTES". SQLSTATE=42601 SQLCODE=-104

z/OS (Type 2 Connection):

21:32:27 - root - ERROR - Sql Error for <function Workload.run..insert_runner at 0x5009FDFC70> thread 8 iteration 1 : ibm_db_dbi::Error: Exception()

Code:
conn_str=f'"{DATABASE}","{UID}","{PWD}"'
insert = INSERT INTO mammoth.TABLE_INSERT_001 \ (PARTNUM,UNIQUE_NUM,ACCT_NUM,CUST_LAST_NM,BALANCE,FIRST_NAME,LAST_NAME,COUNTRY) \
VALUES ('0','255356469','301806095','80317489','84','Bethany','Beck','Lao People's Democratic Republic')

connectionID = ibm_db_dbi.connect(connString, '', '')

if not connectionID is None:
cursorID = connectionID.cursor()

try:
 cursorID.execute(insert)

except Exception as e:
logging.error(f"Execution Error : {exp}")
Finally:
logging.infof"Execution Completed”)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions