Re: PostgreSQL_db_change_notification - Mailing list pgsql-jdbc

From Greg Stark
Subject Re: PostgreSQL_db_change_notification
Date
Msg-id 407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com
Whole thread Raw
In response to PostgreSQL_db_change_notification  (iceDice <nmilasinovic@gmail.com>)
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: iceDice
Date:
Subject: PostgreSQL_db_change_notification
Next
From: Andreas Joseph Krogh
Date:
Subject: Retrieving results from ARRAY and ROW