Reputation: 31
For a project I need to list any mysql database changes in a java program. De database contains links to files. The purpose is whenever a link in de database changes the java program gets notified and starts downloading the file.
What is the best way to do this?
Upvotes: 0
Views: 33
Reputation: 46
I would suggest you to use database trigger which will populate a new table (let say it named link_change) each time there is update or insert operation onto the link table.
This link_change then will need to be polled periodically (E.g.: using select, via JDBC), and being processed by your java program. And it should delete the records that has been processed.
Ref:
https://en.wikipedia.org/wiki/Database_trigger
https://dev.mysql.com/doc/refman/5.7/en/trigger-syntax.html
Upvotes: 1