0

I have a PostgreSQL database and a Java application which accesses this database using JDBC. Works just fine.

Now I have a table in the database, which is changed by some third party and I would like to get a notification from the database (over JDBC) to my Java application, if the data in this table is changed.

Currently I'm just checking the table in regular time intervals from my Java application (polling). But I think it's rather inelegant and generates some unnecessary traffic.

Is possible? And if yes, any pointers how I can achieve this?

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
immnek
  • 49
  • 3
  • 3
    The [Listen/Notify](https://stackoverflow.com/questions/21632243/how-do-i-get-asynchronous-event-driven-listen-notify-support-in-java-using-a-p) mechanism combined with a trigger on the table could be something worth looking at. – Kayaman Feb 07 '20 at 11:07
  • thanks. i will look into this. sounds promising. – immnek Mar 09 '20 at 10:34
  • If polling works for you, it's still a lot easier. Think carefully how much you value perceived elegance over simplicity. – Kayaman Mar 09 '20 at 11:01

0 Answers0