You can use event notification to have your application notified when an SAP Open Server procedure is executed.
To use this feature, you must use the SybConnection class, which extends the Connection interface. SybConnection contains a regWatch method for turning event notification on and a regNoWatch method for turning event notification off.
Your application must also implement the SybEventHandler interface. This interface contains one public method, void event(String proc_name, ResultSet params), which is called when the specified event occurs. The parameters of the event are passed to event, which tells the application how to respond.
SybConnection.regWatch(proc_name,eventHdlr,option)
where:
proc_name is a string that is the name of the registered procedure that generates the notification.
eventHdler is an instance of the SybEventHandler class that you implement.
option is either NOTIFY_ONCE or NOTIFY_ALWAYS. Use NOTIFY_ONCE if you want the application to be notified only the first time a procedure executes. Use NOTIFY_ALWAYS if you want the application to be notified every time the procedure executes.
Whenever an event with the designated proc_name occurs on the SAP Open Server, SAP jConnect calls eventHdlr.event from a separate thread. The event parameters are passed to eventHdlr.event when it is executed. Because it is a separate thread, event notification does not block execution of the application.
If proc_name is not a registered procedure, or if SAP Open Server cannot add the client to the notification list, the call to regWatch throws a SQL exception.
SybConnection.regNoWatch(proc_name)