Skip to content

IBM DB2 support

Platipus edited this page Sep 13, 2024 · 8 revisions

Lets say this are the tables imported in Jam.py:

IBMdb_03

From the BD2 server console, we can use DB2INST1 user to list the tables:

db2 list tables for all |grep WEB
WEBREPORTS                      DBO             T     2015-12-22-09.13.38.088070
WEBREPORTS_FILES                DBO             T     2015-12-22-09.13.38.397378

If we are connecting with DB2INST1 user from Jam.py application (or any other user, note the DBO above!), the Python ibm_db driver will report:

Traceback (most recent call last):
...
ibm_db_dbi.ProgrammingError: ibm_db_dbi::ProgrammingError: 
Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N  
"DB2INST1.webreports" is an undefined name.  SQLSTATE=42704 SQLCODE=-204
...

If we create the DB aliases, the error will go away:

db2 "create alias webreports for dbo.webreports"
db2 list tables for all |grep WEB
WEBREPORTS                      DB2INST1        A     2024-09-12-12.05.02.042117
WEBREPORTS_FILES                DB2INST1        A     2024-09-12-13.21.30.675683
WEBREPORTS                      DBO             T     2015-12-22-09.13.38.088070
WEBREPORTS_FILES                DBO             T     2015-12-22-09.13.38.397378

After creating the alias, Jam will happily present the page:

IBMdb2

Instead of creating the aliases, we could use the SCHEMA_NAME, however, this would need expanding the database connection form with a Schema Name.

Not sure if this is worth doing, since no one ever asked for IBM DB2 support.

Clone this wiki locally