- Connecting to the Database
- Cursor
- zxJDBC and MetaData
- Prepared Statements
- Errors and Warnings
- dbexts
- About This Article
Errors and Warnings
Exceptions that may be raised in zxJDBC are the following:
ErrorThis is the generic exception.
DatabaseErrorRaised for database-specific errors. The connection object and all the connection methods (connect, lookup, conntectx) may raise this.
ProgrammingErrorRaised for programming errors such as missing parameters, bad SQL statements. The cursor object and the lookup connection may raise this.
NotSupportedErrorThis exception is raised when a method is not implemented.
Each of these exceptions are within the zxJDBC package, so except clauses should look like the following:
>>> try: ... pass #Assume a method that raises and error is here ... except zxJDBC.DatabaseError: ... pass # Handle DatabaseError ... except zxJDBC.ProgrammingError: ... pass # handle ProgrammingError ... except notSupportedError: ... pass # handle not supported error ... except zxJDBC.Error: ... pass # Handle the generic Error exception
You can also get warnings with the cursor's warnings attribute. If no warnings exist, then the cursor.warnings attribute is None.