AIX - Python - db2.py
Cary Coulter
cwc_NO at sound_NO.net
Thu Dec 6 00:14:20 EST 2001
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 = DB2Connection(dsn='xxx', uid='xxx', pwd='xxx')
curs = conn.cursor()
# 1
ret = curs.execute("SELECT * from TABLE")
data = curs.fetchall()
# 2
ret = curs.execute("SELECT * from TABLE WHERE ID LIKE 'abc%'")
data = curs.fetchall()
# 3
ret = curs.execute("SELECT ID, NAME from TABLE")
data = 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
More information about the Python-list
mailing list