473,804 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

notification about DB changes

Hi,

I have an application bound to a database through ADO.NET, how can it be
notified when the database content is updated by a third party ?

If you have any idea or link that I could read I would very appreciate.
If ADO.NET is not the solution, with which engine can this be done?

Thank you,
Marty
Jan 4 '06 #1
9 4766
Marty,

You will want to look into the SqlDependency class in .NET 2.0. There
really is no clean way in .NET 1.1 and before.

However, you have to ask yourself what you are using the SqlDependency
for. It is very resource intensive, and you shouldn't use it on tables that
change frequently (since it all requires an open connection).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Marty" <xm******@hotma il.com> wrote in message
news:dKPuf.4231 8$OU5.12642@clg rps13...
Hi,

I have an application bound to a database through ADO.NET, how can it be
notified when the database content is updated by a third party ?

If you have any idea or link that I could read I would very appreciate. If
ADO.NET is not the solution, with which engine can this be done?

Thank you,
Marty

Jan 4 '06 #2
What is your database engine?

If you are using SQL 2000, have a look at the Notification Services:
http://www.microsoft.com/sql/technol...n/default.mspx

SQL 2005 and Visual Studio 2005 eased that part.

--
HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Concept S2i inc. (www.s2i.com)
http://emoreau.s2i.com/

"Marty" <xm******@hotma il.com> wrote in message
news:dKPuf.4231 8$OU5.12642@clg rps13...
Hi,

I have an application bound to a database through ADO.NET, how can it be
notified when the database content is updated by a third party ?

If you have any idea or link that I could read I would very appreciate. If
ADO.NET is not the solution, with which engine can this be done?

Thank you,
Marty

Jan 4 '06 #3
Hello Eric,

my DB engine is MySQL. Do you have a link for that,

thank you :)
marty

Eric Moreau wrote:
What is your database engine?

If you are using SQL 2000, have a look at the Notification Services:
http://www.microsoft.com/sql/technol...n/default.mspx

SQL 2005 and Visual Studio 2005 eased that part.

Jan 4 '06 #4
Hello Nicolas,

I understand that this can be ressource intensive. What is the
alternative to keep a grid updated by databse chages? I mean, would it
be by constantly pooling the DB for evantual changes?

Regards,
marty

Nicholas Paldino [.NET/C# MVP] wrote:
Marty,

You will want to look into the SqlDependency class in .NET 2.0. There
really is no clean way in .NET 1.1 and before.

However, you have to ask yourself what you are using the SqlDependency
for. It is very resource intensive, and you shouldn't use it on tables that
change frequently (since it all requires an open connection).

Hope this helps.

Jan 4 '06 #5
Marty,

Yes, that is the general technique. Basically, refresh when needed. It
doesn't scale too well when you have a constant connection open...
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Marty" <xm******@hotma il.com> wrote in message
news:E8Uuf.3926 0$m05.2327@clgr ps12...
Hello Nicolas,

I understand that this can be ressource intensive. What is the
alternative to keep a grid updated by databse chages? I mean, would it be
by constantly pooling the DB for evantual changes?

Regards,
marty

Nicholas Paldino [.NET/C# MVP] wrote:
Marty,

You will want to look into the SqlDependency class in .NET 2.0.
There really is no clean way in .NET 1.1 and before.

However, you have to ask yourself what you are using the
SqlDependency for. It is very resource intensive, and you shouldn't use
it on tables that change frequently (since it all requires an open
connection).

Hope this helps.


Jan 4 '06 #6
The other option that can be used in a real-time environment is to 'stage'
the data. So instead of 'you' going to the database another server is
responsible for accessing and updating the data from the database. When you
require the Table/Row/Item you send a request and optionally register your
interest in the data. A copy of data is returned to you and if it is changed
by someone else you are notified and will continue to be so until you
unregister.

You may also implement a 'read-only' lock at register time. Locked data
cannot be changed by anyone else apart from timeouts on the part of the
locker. Updates can only be done by the locker.

Updates to the data are done by notifying the server of the change and
releasing of the lock. The Server writes the data to the database whenever it
sees fit.

This process is more efficient than database notification but of course
requires a considerable amount of effort to write. (I know - been there, done
that). It also has the advantage that it can be used for non-database
information, especially if the only reason the data was placed in the
database was to share it rather than take advantage of relationships.
--
Paul
"Marty" wrote:
Hello Nicolas,

I understand that this can be ressource intensive. What is the
alternative to keep a grid updated by databse chages? I mean, would it
be by constantly pooling the DB for evantual changes?

Regards,
marty

Nicholas Paldino [.NET/C# MVP] wrote:
Marty,

You will want to look into the SqlDependency class in .NET 2.0. There
really is no clean way in .NET 1.1 and before.

However, you have to ask yourself what you are using the SqlDependency
for. It is very resource intensive, and you shouldn't use it on tables that
change frequently (since it all requires an open connection).

Hope this helps.

Jan 4 '06 #7
Marty,

SQL notification services is a SQL Server specific technology. Other
databases might have it, but the classes in the framework are for SQL Server
only.

If you want to use something with MySQL, you have to look for a solution
specific to that server.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Marty" <xm******@hotma il.com> wrote in message
news:b6Uuf.3925 9$m05.38986@clg rps12...
Hello Eric,

my DB engine is MySQL. Do you have a link for that,

thank you :)
marty

Eric Moreau wrote:
What is your database engine?

If you are using SQL 2000, have a look at the Notification Services:
http://www.microsoft.com/sql/technol...n/default.mspx

SQL 2005 and Visual Studio 2005 eased that part.

Jan 4 '06 #8
Hi Paul, thank you for your ideas,
The other option that can be used in a real-time environment is to 'stage'
the data. So instead of 'you' going to the database another server is
responsible for accessing and updating the data from the database. When you
require the Table/Row/Item you send a request and optionally register your
interest in the data. A copy of data is returned to you and if it is changed
by someone else you are notified and will continue to be so until you
unregister.


This first case is the one we have (without the "registerin g" part of it).
How this "registerin g" is implemented?
Is it on database side?
Would it work with mySQL ?

Regards,
marty
Jan 4 '06 #9

The registration is totally external to the database and is done by the
"data server". The dataserver is a program sitting between the application
and the database.

This method normally works by sending a TCP request from the application to
the "data server" which may or may not reside on the same machine as the
database. Performance is better if it does.

Your application call is of the form:

ReplyClass rc = SendRequest(Req uestType, RequestParamete rs. Registration)

Request Type: Delete, Update, move, lock, unlock - You decide
Request Parameters: Totally application dependant

The registration parameter tells the dataserver what to do...

1) Just give me the data and forget I ever asked for it.
2) Give me the data and tell me when someone (including me) changes it. I
will supply a key to you (the dataserver) and when it is updated send me back
the key and the updated field / row whatever.
3) Give me the data and lock it against changes by anybody else.
4) Update and unlock (or just unlock)
If you are going to read and update later you would put a lock on it. I use
the word registration here as it was commonly used in Service-based OOP
programming.

The Data Server has the problem of tracking all the requests and memorizing
them. Each 'user+applicati on' requires a unique ID so the dataserver can
track who has what.

There are a number of areas to be careful about:

1) Applications must tell the dataserver when they are closing so the
dataserver can release all locks. Users switching off / crashing without
closing down can cause problems. Lock timeouts are essential.

2) If there is a considerable delay between the read and update (or rather
the dataserver request to read and the dataserver request to update) then it
will be necessary to ...
read without lock
let the user do his thing
read with lock to make sure nothing has changed
update and release lock

3) Each user application must have a Listener running so it can receive
updates.

4) Deadly embraces can happen but a short timeout can fix that.

5) The application / client side has to cope with notification that a lock
has timed out or been supplanted by a request with a higher permission.

Like I say - it's lot of work and you have to get your logic right. But once
re-usable objects are written it is easy. And only use this architecture when
really necessary. 90% of your stuff will continue to use good old selects.

--
Paul
"Marty" wrote:
Hi Paul, thank you for your ideas,
The other option that can be used in a real-time environment is to 'stage'
the data. So instead of 'you' going to the database another server is
responsible for accessing and updating the data from the database. When you
require the Table/Row/Item you send a request and optionally register your
interest in the data. A copy of data is returned to you and if it is changed
by someone else you are notified and will continue to be so until you
unregister.


This first case is the one we have (without the "registerin g" part of it).
How this "registerin g" is implemented?
Is it on database side?
Would it work with mySQL ?

Regards,
marty

Jan 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2510
by: Grady | last post by:
Help. I need to create a simple database that tracks equipment arrivals (and departures) at my facility. What I want is to create a simple form, which the receptionist could fill out, every time someone delivers something at the front door. The form would simply have a place to put the time/date, delivery method, addressee, and a brief description. Once the receptionist filled it out and hit enter it would create a new record and then...
6
7231
by: Raphael Gluck | last post by:
Hi, Is it possible for one to program one's pages as such that when a database table is updated over the web, via a form, that an e-mail confirmation is sent to a specified address, notifying the update has taken place? If so is there a tutorial out there that is easy to understand and implement? Thanks so much
5
2084
by: jason | last post by:
I could sure use some conceptualization and query help with a Page Watch System I am building in Access 2000 and Asp. I need to cycle through databae and generate a compiliation query email that notifies a person of yacht(s) that have changed on our website: Key database tables ---------------------------------------------------------------------------- Customer (1) --->> (many) Customer_Boats (many)<<---- Boat (1)
4
13751
by: Charles Law | last post by:
Is there an event or notification that my application can receive when a USB device (or other) is plugged in? I have looked at WMI as this appears to be the right area but cannot see how to get notification when this particular event occurs. The same goes for removal as well. TIA Charles
4
2580
by: Rick | last post by:
I developing a large project that will have numerous text boxes, datetime controls, checkboxes etc. all data bound to a dataset/datatable/tableadapter. I'm wondering what is the normal way to get notification from the program that the user has changed some databound item? I know I can tap into the OnChange event of all these individual controls, however it seems like there should be something exposed at a more common level. I looked...
2
2155
by: cjard | last post by:
Suppose: A TextBox is bound to a BindingSource, which is bound to a DataTable A BindingNavigator is used to alter the current row being looked at by the BindingSource (i.e. Nav's NEXT button is pressed. BS.Position changes from 2 to 3, Textbox was showing APPLE, now shows ORANGE) Does the textbox receive any notification that this occurred? If so, what?
6
1534
TonFrere
by: TonFrere | last post by:
Hello, I'm simply trying to keep track of changes on a windows form as users modify control values. I created a boolean variable called IsDirty and want it set to true whenever the user changes something. The problem is: where to set IsDirty to true? If I raise the event on "TextChanged" event of a control (let say a textbox), it is set to true whenever the user changes current record. I also tried to raise it on "Validating" event but...
2
1929
by: Jurjen de Groot | last post by:
I will be developping a planning application for wich it's necessary for multiple users to view and edit the same data, all changes made by one user, must be visible to the other user's more or less immediately (on their pc). So I'm looking for a mechanism with wich I can notify the 'other' applications on the network of any changes so they can update their 'view' if necessary. Although I think I'm capable of solving this problem by...
1
4453
ashitpro
by: ashitpro | last post by:
Hi there, I am working on a distributed service detection project, written in C/C++ Platform is Linux. Each system under network has mysql database for general storage. If first node queries to second node and if request gets satisfied, First node will put these results in its local cache table. So whenever same query gets fired on first node, it would just return the results from its cache table. The problem arises when second node changes...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.