|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Notify Apps When DB is UpdatedJust wondering what techniques are generally available or employed when
different client application instances must be notified when data changes in a database. For example, assume a basic client/server Windows Forms application that uses SQL Server (2000 or 2005) on the back end. Client1 updates a table; Client2 on a different computer on same LAN must be notified of the change to the DB and have it's cached data updated to reflect the change to the DB (immediately, if not sooner). I'd hate to have the clients periodically polling the db. Can the DB somehow cause an event to fire in the clients? Thanks! Jeff (A@B.COM) writes:
> Just wondering what techniques are generally available or employed when In SQL 2000, polling is probably the best, although you could have> different client application instances must be notified when data > changes in a database. For example, assume a basic client/server Windows > Forms application that uses SQL Server (2000 or 2005) on the back end. > Client1 updates a table; Client2 on a different computer on same LAN > must be notified of the change to the DB and have it's cached data > updated to reflect the change to the DB (immediately, if not sooner). > I'd hate to have the clients periodically polling the db. Can the DB > somehow cause an event to fire in the clients? an extended stored procedure that alerted the client about the change. In SQL 2005 there are more options. Client2 can set up a query notification, so it would be notified if the results of a query changes. Query notification uses the Service Broker framework. You could also implement other solutions with help of Service Broker, but I have no experience of it myself. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||