Catching Database Exceptions (Sybase)

David Bolen db3l at fitlinxx.com
Wed Dec 20 15:53:14 EST 2000


Thomas Gagne <tgagne at ix.netcom.com> writes:

> And miraculously, even with the table missing, it ran the "else".
> 
> I must be missing something significant here.  Any help?

You might try the same operation via some other tool (e.g., ISQL or
equivalent).  It's my understanding from some of the DB folks here
that depending on the type of error, errors within stored procedures
may sometimes be simply absorbed and not reported - you just get back
an empty result.  I know I've run some stored procedures that had bad
references to fields that didn't exist and didn't actually get a
database error from the execution, just no result.

And to answer your follow-up post question, the Warning and Error
classes that the DB API specifies all exceptions must be subclassed
from are themselves DB API-specific exceptions (both are subclasses of
the standard Python exception StandardError).

So in your exception clauses try using "<module>.Warning" instead of
just "Warning" (where <module> is your DB API compliant module).

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list