Yeah, I misspoke there. 2.0.5.1 was the version of ibm_db (and ibm_db_dbi)
that originally shipped. The changes to make ibm_db_dbi work properly for
IBM i went in to 2.0.5.2 (SI58191).
I was able to get the latest version of Python and ibm_db installed on
Litmis Spaces if anyone wants to give it a try. The "None" for username
and password works. If you have an existing Python Space you will need to
delete it and create a new one. To get ibm_db to work I had to run this
command, not sure if this is normally necessary.
pip install
/QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db/ibm_db-2.0.5.4-cp34-cp34m-os400_powerpc.w
hl
----Test Program---
import ibm_db
db_name = '*LOCAL'
schema = '<insert Litmis Space Schema>'
username = None
password = None
try:
conn = ibm_db.connect(db_name, username, password)
except:
print("no connection:", ibm_db.conn_errormsg())
if conn:
result_set = ibm_db.exec_immediate(conn, "SET SCHEMA " + schema)
result_set = ibm_db.exec_immediate(conn, "CREATE TABLE CUSTOMER ( CUSNUM
NUMERIC(6, 0), LSTNAM VARCHAR(50) )")
result_set = ibm_db.exec_immediate(conn, "INSERT INTO CUSTOMER VALUES
(123,'Smith')")
result_set = ibm_db.exec_immediate(conn, "SELECT * FROM CUSTOMER")
ibm_db.fetch_row(result_set)
print(ibm_db.result(result_set, 0))
print(ibm_db.result(result_set, 1))
ibm_db.close(conn)
else:
print ('connection failed')
Aaron Bartell
litmis.com - Services for open source on IBM i
As an Amazon Associate we earn from qualifying purchases.