[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:

                self.oraCursor = self.conn.cursor()
                print "query error (donno what the problem is) \n" + \

                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

            # print self.oraCursor.fetchall()

Thanks in advance


Richard Brosnahan
Editor in Chief
Broz News
Hand Picked Technical News
Updated Every Business Day!