Karl Cassar
Karl Cassar

Reputation: 6483

notify a process / ASP.Net application when a database row is updated

I don't know if this is possible, or if it even makes sense. If one would have say 2 servers for a web application, and one does an update on Server 1, server 2 wouldn't know about the update. This is especially problematic for caching, as the Server 2 would have a 'stale' copy of the cached item.

Is there any way to 'notify' both servers, whenever say a database row is updated? The database in use is MySQL. If not, any ideas / best practices on how one would go about this?

We are looking to move to a server-farm, and this is currently one of the most problematic issues we are finding.

Upvotes: 0

Views: 316

Answers (3)

Darek
Darek

Reputation: 4797

Use triggers: http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html or MySql replication http://dev.mysql.com/doc/refman/5.0/en/replication.html It really depends what you are trying to accomplish. There are many ways to solve this, including code.

Upvotes: 1

Murtuza Kabul
Murtuza Kabul

Reputation: 6514

Have a look at this

http://dev.mysql.com/doc/refman/5.0/en/replication.html

It brief out the replication function available in MySql server. It is the in built feature of mysql server for this purpose.

Upvotes: 0

andreasnico
andreasnico

Reputation: 1488

You should not get caught up to much that the change is in the database. It's your c# code that should handle this. You could fire an event in the method setting the new value and then by using i.e some wcf service communicate to the other server that it must clean it's cache/uptdate it's value.

Upvotes: 0

Related Questions