Re: PostgreSQL_db_change_notification

From: Greg Stark <gsstark(at)mit(dot)edu>
To: iceDice <nmilasinovic(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PostgreSQL_db_change_notification
Date: 2009-07-06 18:27:55
Message-ID: 407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Jul 6, 2009 at 6:57 PM, iceDice<nmilasinovic(at)gmail(dot)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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andreas Joseph Krogh 2009-07-07 00:14:00 Retrieving results from ARRAY and ROW
Previous Message iceDice 2009-07-06 17:57:27 PostgreSQL_db_change_notification