简体   繁体   中英

How to know in java about MYSQL updates

Is it possible to get in Java some events (table was updated or ect) from MySQl. thanks!

You can add a trigger on the update/insert in MySQL. Then one possible solution would be to add a kind of logging record to a DB table, which you can poll in java.

In case you are looking for Event handling (do something if database is updated) then it would be better to do it the middleware itself as it should be your prime source of database operation.

Else you will have to do some kind of polling on some attribute and then perform your action.

If you are looking to do something on front end if database is updated then you can use Reverse Ajax which will inform the user when database is updated, but here also middleware will generate the condition for Reverse Ajax for it to publish the notification.

As far as I know, MySQL does not support events. If you are looking for a database which does support events, you might want to look at Firebird .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM