[DB-SIG] IBM DB2 interface module DB2.py

Coulter, Cary Cary.Coulter@argushealth.com
Mon, 3 Dec 2001 13:27:44 -0600


I'm running DB2 on AIX.  Using the DB2.py (v0.99) module. I'm able to
fetch some data but am having a problem.

Sample code:

import DB2

conn =3D DB2Connection(dsn=3D'xxx', uid=3D'xxx', pwd=3D'xxx')

curs =3D conn.cursor()

# 1
ret =3D curs.execute("SELECT * from TABLE")
data =3D curs.fetchall()

# 2
ret =3D curs.execute("SELECT * from TABLE WHERE ID LIKE 'abc%'")
data =3D curs.fetchall()

# 3
ret =3D curs.execute("SELECT ID, NAME from TABLE")
data =3D curs.fetchall()



The first 2 select/fetchall's work.  'data' is a list of tuples
containing the row data.  Dumping curs.description shows a tuple of
tuples with all of the columns and their attributes.

The third execute/fetchall doesn't work completely.  'data' is a empty
list ([] rather than None) but curs.description contains a tuple of
tuples for the 2 columns specified.


Any idea why #3 won't work or something to look at??  I can put some
debug code in the _db2_module.c code and log stuff to disk, but first
I'm looking for something simpler than learning the low level interface
to DB2.

Thanks in advance.


Cary Coulter
Lead System Programmer
816-435-2425
Argus Health Systems, Inc.