开发者

Is there a way to listen for changes in an MySQL database table using Java and JDBC?

I have a number of users which are logged in at a time in my desktop application. They are working on the same table (create, read, update, delete 开发者_如何学运维data) so I have to update their views, to reflect changes, every few seconds - currently I am thinking to use a different thread to do that.

I am using the MySQL database engine.

Is there a way, using JDBC, to listen for changes on a specific table in the database and triggering a Java method only when changes are made?


No, mysql does not support sending async notifications to a client, nor does it have any ways of waiting for table changes.

You'd have to build your own data access layer, where you support this in your code - and all data access would have to go through that same code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜