|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Allows you to implement message handlers
which will be called when the message occurs in addition to, or as an
alternative to
catching thrown exceptions;
for example, to isolate complicated
and possibly Sybase-specific error handling code in a single location
rather than having to reproduce it in many individual
catch blocks. It can also be used to modify the severity of certain
errors
so that they result in SQLWarnings rather than
SQLExceptions, or
to create a log of all server messages received by the
application.
A message handler can be installed in a SybDriver,
SybConnection, or
SybStatement by calling that object's
setSybMessageHandler method. A
message handler can be installed for all connections by using the
SybDriver's setSybMessageHandler; all
subsequently created connections will
inherit this handler. You can also set the handler object for a
SybConnection, causing all subsequent SybStatements
to use this same
handler; however, if a SybConnection did not have any handlers when a
SybStatement was created, subsequently installing a handler in the
SybConnection will not have any retroactive effect on the
SybStatement.
Also, changing the installed handler only affects statements created
in the future; existing statements keep their existing handlers.
Similarly, installing a handler on a SybDriver affects only
future connections, not existing ones.
SybDriver.setSybMessageHandler(com.sybase.jdbcx.SybMessageHandler),
SybConnection.setSybMessageHandler(com.sybase.jdbcx.SybMessageHandler),
SybStatement.setSybMessageHandler(com.sybase.jdbcx.SybMessageHandler)| Method Summary | |
SQLException |
messageHandler(SQLException sqe)
Upon arrival of a message, the messageHandler
method is invoked from
within the jConnect driver and control is returned to the application. |
| Method Detail |
public SQLException messageHandler(SQLException sqe)
Upon arrival of a message, the messageHandler
method is invoked from
within the jConnect driver and control is returned to the application.
The handler will be invoked only for
messages generated by the server; it will not
be invoked for messages generated by jConnect itself.
When a SQLException reference is passed to the handler, the
application can take one of three actions:
SQLWarning, which jConnect will
append to the appropriate warning chain
SQLException, which jConnect will
throw.
The handler may take other actions as well, such as modifying data structures or canceling statements.
sqe - the error information prepared by jConnect
This is an instance of either SybSQLException or
SybSQLWarning.
Extended error data may be obtained by casting it and
using the calls in
EedInfo.EedInfo,
SybSQLException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||