[DB-SIG] RE: DB-SIG digest, Vol 1 #530 - 1 msg

Coulter, Cary Cary.Coulter@argushealth.com
Tue, 11 Dec 2001 13:04:47 -0600


No change.


-----Original Message-----
From: Matthew Vranicar [mailto:vranicar@fnal.gov]=20
Sent: Thursday, December 06, 2001 10:13 AM
To: db-sig@python.org; Coulter, Cary
Subject: Re: DB-SIG digest, Vol 1 #530 - 1 msg


Cary,
What if you did not just reuse the same cursor, but used individual
cursor
objects for each of your queries?  Or at least closed/opened the cursor
again.  Would this help?

Like this:

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

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

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

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


db-sig-request@python.org wrote:

> Send DB-SIG mailing list submissions to
>         db-sig@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.python.org/mailman/listinfo/db-sig
> or, via email, send a message with subject or body 'help' to
>         db-sig-request@python.org
>
> You can reach the person managing the list at
>         db-sig-admin@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of DB-SIG digest..."
>
>
------------------------------------------------------------------------
> Today's Topics:
>
>    1. IBM DB2 interface module DB2.py (Coulter, Cary)
>
>
------------------------------------------------------------------------
>
> Subject: [DB-SIG] IBM DB2 interface module DB2.py
> Date: Mon, 3 Dec 2001 13:27:44 -0600
> From: "Coulter, Cary" <Cary.Coulter@argushealth.com>
> To: <db-sig@python.org>
>
> 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.