[DB-SIG] DCOracle2 and Exceptions

Matthew T. Kromer matt@zope.com
Wed, 10 Apr 2002 10:07:38 -0400


Richard Brosnahan wrote:

>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)
>                
>e
>

And self.conn is a valid connection object?  The most likely answer is 
that you aren't connected to the database.  The Oracle error message is 
raised as the value of the error -- what does it say?

-- 
Matt Kromer
Zope Corporation  http://www.zope.com/