[DB-SIG] DCOracle2 and Exceptions
Richard Brosnahan
broz@mac.com
Wed, 10 Apr 2002 07:56:57 -0400
Hi folks,
This is probably a simple question, and something I might eventually figure
out, but I thought I'd post here to expedite things a bit.
I've wrapped a self.oraCursor.execute(theQuery) call in a try block, to trap
bad queries. I'd like to know when a bad query gets passed in and what's
wrong. Heck, just knowing it's a bad query would be a big help. The problem
is, EVERY query passed in drops into one of the exceptions (DatabaseError).
I print the query and plunk it into sqlplus, where it works fine. Nothing
wrong with it. Indeed, DCOracle is processing the query and the database is
modified as expected. What am I missing here?
DCOracle2 (stable), Red Hat 7.2, Oracle 9i, Python 2.2.
Here's a code snippet:
try:
try:
self.oraCursor = self.conn.cursor()
self.oraCursor.execute(theQuery)
except(DCOracle2.DatabaseError):
print "query error (donno what the problem is) \n" + \
theQuery
if self.oraCursor.description:
print list(self.oraCursor.description)
except(DCOracle2.Error, self.theError):
print "generic error: " + self.theError
except(DCOracle2.Warning, self.theError):
print "query warning: " + self.theError
except(DCOracle2.InterfaceError, self.theError):
print "interface error: " + self.theError
except(DCOracle2.InternalError, self.theError):
print "internal error: " + self.theError
except(DCOracle2.OperationalError, self.theError):
print "OperationalError: " + self.theError
except(DCOracle2.ProgrammingError, self.theError):
print "ProgrammingError: " + self.theError
except(DCOracle2.IntegrityError, self.theError):
print "IntegrityError: " + self.theError
except(DCOracle2.DataError, self.theError):
print "DataError: " + self.theError
finally:
# print self.oraCursor.fetchall()
self.oraCursor.close()
Thanks in advance
--
Richard Brosnahan
Editor in Chief
Broz News
Hand Picked Technical News
Updated Every Business Day!
http://broznews.com/