有什么方法可以让MySQL服务器“推送"数据库更新到客户端程序吗? [英] Is there any way to let MySQL server 'push' DB updates to a client program?
问题描述
一个典型的场景:假设用户正在将数据馈送到MySQL,而客户端则远程连接到MySQL.每当用户更新数据库中的字段时,我希望立即通知客户端.
A typical scenario: imagine a user is feeding data to MySQL, while a client is connected to MySQL remotely. Whenever the user updates a field in the DB, I would like for the client to be notified immediately.
将其视为Blackberry的推送邮件"功能.
Think this as the 'push-mail' function from Blackberry.
我不希望的是,客户端必须不时地"ping" MySQL服务器,以查看是否有任何更新.我相信这将是昂贵的计算.
What I do NOT want, is that the client has to 'ping' MySQL server once in a while to see if there is any update. I believe this will be to expensive, computation wise.
如何实现这样的想法?是否有任何基于MySQL的CALLBACK机制?如果不是,是否还有其他数据库(最好是开源的)支持这种机制?
How can I implement such an idea? Is there any MySQL-based CALLBACK mechanism? If not, is there any other database (better be open-source) that support this kind of mechanism?
推荐答案
对于对缓存失效技术感兴趣的主动连接的客户端:
For an actively connected client interested in cache invalidation techniques:
- SQL Server support Query Notifications
- Oracle support Continuous Query Notifications.
- MySQL supports replication streams, but they're not the same as update notification: they cannot be set up and tear down dynamically for a client and they do not work well for monitoring individual rows a particular application is interested in.
对于对数据同步感兴趣的断开连接的客户端,所有供应商都支持某种复制.
For a disconnected client interested in data sync, all vendors support some sort of replication.
这篇关于有什么方法可以让MySQL服务器“推送"数据库更新到客户端程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!