[Zope-DB] Connection Close Errors with External Method
Samir Mishra
SamirMishra@cbuae.gov.ae
Sun, 20 Jul 2003 08:08:08 +0400
Hello All,
I'm getting the following error with an external method I have for accessing
a SAP DB.
Exception sapdb.dbapi.OperationalError: <sapdb.dbapi.OperationalError
instance at
026855BC> in <method Connection.close of Connection instance at 027232B4>
ignored
It doesn't seem to create any problems, since it's only when I'm trying to
close the connection that I get the error.
I'm listing the external method below. As you can see, the script is almost
simplistic. If run in Pythonwin, I don't see the above error.
Anyone else have to deal with this? Any ideas?
Thanks.
Samir.
"""
External method to access SAP DB from within Zope
for returning data - will accept SQL multiple statements at a time
"""
import sapdbapi
def getdata(query, connect_string):
conn = sapdbapi.Connection(connect_string['username'], \
connect_string['password'], \
connect_string['database'], \
connect_string['host'])
conn_c = conn.cursor()
if type(query) == type(""):
query = [query]
conn_d = []
conn_desc = []
for i in query:
try:
conn_q = conn_c.execute(i)
if conn_q == 0:
conn_desc.append(None)
else:
conn_desc.append(conn_q.description)
conn_d.append(conn_c.fetchall())
except:
conn_q = 0
conn.close()
return {'description': conn_desc, 'data':conn_d,
'error':i}
conn.close()
return {'description':conn_desc, 'data':conn_d, 'error':0}