I'm running python 3 on an iseries and I want to connect to the local database. The command
import ibm_db
conn = ibm_db.connect('XXXX','YYYYY','ZZZZ')
is successful but when I run
sql = "SELECT * FROM V40DTALIB.SCHOOL"
I get the error
SCHOOL in V40DTALIB type *FILE not found. SQLSTATE=42704 SQLCODE=-204
The file is there and the credentials I'm using are authorised. I think it's because the library is on an IASP. Normally this would be mounted by the user profile job description but this is obviously not happening. If I replace the file with a QGPL one (in sysbase) I don't get this error.
I'd like to run SETASPGRP ASPGRPXXX.
I've tried
ibm_db.exec_immediate(conn, "call qcmdexc('SETASPGRP ASPGRP(IASPEXAM)')")
Exception: Trigger program or external routine detected an error. SQLSTATE=38501 SQLCODE=-443
I don't know where to look for further information or job logs etcetera. Anybody have a clue?
Take a closer look at this line...
conn = ibm_db.connect('XXXX','YYYYY','ZZZZ')
I believe 'XXXX'
is the database name. If you have a IASP, you likely have at least two databases. Make sure you have the right one for the IASP.