July 5, 2004 at 7:23 am
Hi,
Anyone know what is the best way to monitor a table for new entries using Java? I am connecting to SQL Server using the Microsoft Driver thru WebLogic 8.1. I need to run some code each time a new entry is inserted into a particular table. In Informix i used callbacks so that code would execute when events were fired. What can i do in SQL Server? Apologies if this is in the wrong forum.
Thanks for any help!
Mike
July 5, 2004 at 7:34 am
You could use a trigger on the table. The trigger will fire whenever an action takes place on the table. If you really want to, you could see if the trigger will allow you to run an extended stored procedure which will allow you to execute a DLL. Put your code in the DLL. Many DBA's don't like triggers though (any views on this?)
Another way of course (less performance overhead) is to add a new column to your table with a DEFAULT of NULL. You can write a Java app to poll the table, and take action when the column is NULL, then set it to a NON NULL value.
July 5, 2004 at 7:55 am
Wayne,
Yeah, I think polling is the way to go, don't have a lot of control over triggers. I can ask for an extra column no problem though.
Thanks,
Mike
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply