Обсуждение: PostgreSQL_db_change_notification
Hello, Does PostgreSQL supports some database change notification mechanism? I have Java Swing application and PostgreSQL database for storing data. The problem is that my database can change at any moment and instead of querying the database every 5 seconds, I would like the database to some how send my application a notification of a change when it happens. I would appreciate if someone can give me example how to accomplish it between JDBC and PostgreSQL. Thanks. -- View this message in context: http://www.nabble.com/PostgreSQL_db_change_notification-tp24360061p24360061.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
On Mon, Jul 6, 2009 at 6:57 PM, iceDice<nmilasinovic@gmail.com> wrote: > > Does PostgreSQL supports some database change notification mechanism? > I have Java Swing application and PostgreSQL database for storing data. > The problem is that my database can change at any moment and instead of > querying > the database every 5 seconds, I would like the database to some how send my > application > a notification of a change when it happens. The Postgresy way to do this is to have triggers on the tables you want to watch which use the NOTIFY command. Then have your client issue a LISTEN. I'm not sure how this works with JDBC though... -- greg http://mit.edu/~gsstark/resume.pdf