Best way of Data Sync
-
Hi, I am bulding a simple windows application. the forms read data from the database and show it. the user can modify the data through the forms and the data is updated. it works fine as long as it is used by single user on a single machine. But I want this to be used by different users on the network. There may be an instance where two or more users can open the same form. So any changes made to a record by one user can not be reflected on the other end :(. but i want changes to be reflected on all machines where the same form is opened. How can i achieve this :confused: ? Please suggest me a way ? thanks in advance
kss
-
Hi, I am bulding a simple windows application. the forms read data from the database and show it. the user can modify the data through the forms and the data is updated. it works fine as long as it is used by single user on a single machine. But I want this to be used by different users on the network. There may be an instance where two or more users can open the same form. So any changes made to a record by one user can not be reflected on the other end :(. but i want changes to be reflected on all machines where the same form is opened. How can i achieve this :confused: ? Please suggest me a way ? thanks in advance
kss
fearless stallion wrote:
the forms read data from the database and show it
What data provider you use? Whether you use Oracle, Sql Server, Db2, etc... It's the responsibility of that Database engine to synchronize the data read/write access. For sure there won't be any write errors, yet if you didn't update your data in the form, it could be inaccurate as it has been updated by another user. So from time to time you should refresh your display based on something -e.g. timer, events, messages, etc...-.
Regards:rose:
-
Hi, I am bulding a simple windows application. the forms read data from the database and show it. the user can modify the data through the forms and the data is updated. it works fine as long as it is used by single user on a single machine. But I want this to be used by different users on the network. There may be an instance where two or more users can open the same form. So any changes made to a record by one user can not be reflected on the other end :(. but i want changes to be reflected on all machines where the same form is opened. How can i achieve this :confused: ? Please suggest me a way ? thanks in advance
kss
If the database is Sql Server 2005, you could always use SQL Server Notifications to notify clients that an event has happened. It would be the responsibility of the client to retrieve/work out what the changes are. This is not a task for the faint hearted and I am currently writing a set of articles on how to use Notifications.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before. -
fearless stallion wrote:
the forms read data from the database and show it
What data provider you use? Whether you use Oracle, Sql Server, Db2, etc... It's the responsibility of that Database engine to synchronize the data read/write access. For sure there won't be any write errors, yet if you didn't update your data in the form, it could be inaccurate as it has been updated by another user. So from time to time you should refresh your display based on something -e.g. timer, events, messages, etc...-.
Regards:rose:
Hi, Thanks for the reply, I think , what i have written earlier is a little confusing. I am using MySql provider. and there is no problem with MySql provider. But what i want is: for eaxmple: if Two users "Chris" and "Sally" open the same form. suppose Chris Modifies the record no.13 and the record is updated to database but Sally's screen still shows the Old data. I can refresh the whole screen by re-fetching the data from the DB but is time consuming. but i want some other solution may be an network event kind, whenever change occurs in other machine. it(machine) sends a message kind to all the peers(who have the same form opened). so that i can manage it on the frontend itself. as the data is huge so it is not possible for me to refresh again and again. How far this is possible ? thanks again
kss
-
If the database is Sql Server 2005, you could always use SQL Server Notifications to notify clients that an event has happened. It would be the responsibility of the client to retrieve/work out what the changes are. This is not a task for the faint hearted and I am currently writing a set of articles on how to use Notifications.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.Thanks but I using MySQL 5.0.
kss
-
Thanks but I using MySQL 5.0.
kss
You could roll your own version. It wouldn't be trivial, but would work like this: Have your application poll a notifications table at a regular interval. Whenever a record is inserted/updated/deleted that you are interested in, update the notifications table. If there is a record there that you are interested in (probably identified via a timestamp) refresh your application
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before. -
You could roll your own version. It wouldn't be trivial, but would work like this: Have your application poll a notifications table at a regular interval. Whenever a record is inserted/updated/deleted that you are interested in, update the notifications table. If there is a record there that you are interested in (probably identified via a timestamp) refresh your application
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.Can MessageQueue be used in this Context ?
kss
-
Hi, Thanks for the reply, I think , what i have written earlier is a little confusing. I am using MySql provider. and there is no problem with MySql provider. But what i want is: for eaxmple: if Two users "Chris" and "Sally" open the same form. suppose Chris Modifies the record no.13 and the record is updated to database but Sally's screen still shows the Old data. I can refresh the whole screen by re-fetching the data from the DB but is time consuming. but i want some other solution may be an network event kind, whenever change occurs in other machine. it(machine) sends a message kind to all the peers(who have the same form opened). so that i can manage it on the frontend itself. as the data is huge so it is not possible for me to refresh again and again. How far this is possible ? thanks again
kss
Well. Here is how I do it 1- Put the database on the server. -intuitive, isn't it?-:) 2- Put a Windows Application -or service-, or Webservice according to either your program is on LAN/Internet respectively, as a gate to that database. 3- All requests are directed to that "Gate" program through remoting 4- All programs record there interest on the current displayed record and the gate keeps track of that 5- if a record is displayed on one client and another modifies it the gate notifies the interested clients using messages. 6- Messages and requests are preferably routed using Remoting. This is one way to do it. Does this help?
Regards:rose:
-
Can MessageQueue be used in this Context ?
kss
Probably not. Well, you could use it but it doesn't bring you any benefits.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before. -
Well. Here is how I do it 1- Put the database on the server. -intuitive, isn't it?-:) 2- Put a Windows Application -or service-, or Webservice according to either your program is on LAN/Internet respectively, as a gate to that database. 3- All requests are directed to that "Gate" program through remoting 4- All programs record there interest on the current displayed record and the gate keeps track of that 5- if a record is displayed on one client and another modifies it the gate notifies the interested clients using messages. 6- Messages and requests are preferably routed using Remoting. This is one way to do it. Does this help?
Regards:rose:
Well I Have never worked on Remoting and if this will help me then i Would not mind Working. I will look into this , if you have any good links of this kind of implementation then can please let me know, it will be of great help Thanks again
kss
-
Well I Have never worked on Remoting and if this will help me then i Would not mind Working. I will look into this , if you have any good links of this kind of implementation then can please let me know, it will be of great help Thanks again
kss