Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use SQLServer Service Broker/SQLNotifications with Delphi7?

delphi 7 and mssql 2008 are requirements I can't change for a new project I'm starting to work and if possible I'd like to get notifications/events if data changes on the server so I don't have to poll so the question is:

is it possible to utilize SQLService broker with D7 or is there something similar (was reading/thinking about crosstalk and ado.net but support starts only at D2007)?

Update: Just to be absolutely clear, I want to be able to get an Event if data changes in certain tables (eg. insert/updates on specific tables) and not if a table/database changes.

like image 778
pastacool Avatar asked Oct 10 '22 17:10

pastacool


1 Answers

Yes, is possible use delphi to access to the notifications and Events exposed by the MSSQL Service Broker. To do this you can use the WMI Provider for Server Events which exposes a very rich set of WMi events and classes. If you are new to the WMI, I recommend you which read these articles Accesing the WMI from Object Pascal Code and Delphi and WMI Events also you can use the WMI Delphi Code Creator to create an Delphi snippet to access the events of the MSSQL Service Broker.

like image 198
RRUZ Avatar answered Oct 13 '22 09:10

RRUZ