call an external command (such as java program but without gui stuff) from a trigger or stored procedure...
Posted on 2004-10-13
What i need for my project is: when a sybase table is changed (insert/update etc), the trigger calls an external java program AA to notify my another java program BB about the changes. The program AA only does 1 thing: sending out an int value to a certain predefined socket, while program BB is waiting there on the socket for incoming message.
The trigger is like:
create trigger book_u_trig
exec xp_cmdshell "AA 9012"
where "9012" is the parameter to program AA and it is also the socket number that AA is going to send out an integer value through.
On the same machine (as Sybase server), i have already run another program BB as
java BB 9012
which means BB is listening to any incoming message on socket 9012.
The background of such a requirement: my project requires to know "realtime" that a table has been changed, so further actions might be taken. It will be inefficient for my project to poll the sybase table at short intervals of time period; instead, i want the table itself to notify my program about the changes.