pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: iceDice <nmilasinovic@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PostgreSQL_db_change_notification
Date: Mon, 6 Jul 2009 19:27:55 +0100
Message-ID: <407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com> (raw)
In-Reply-To: <24360061.post@talk.nabble.com>
References: <24360061.post@talk.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



view thread (2+ messages)

Message-ID: <407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com>
Permalink:  ../407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com/
Also on:    postgresql.org/message-id/407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: gsstark@mit.edu, nmilasinovic@gmail.com
  Subject: Re: PostgreSQL_db_change_notification
  In-Reply-To: <407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com>
  References: <24360061.post@talk.nabble.com> <407d949e0907061127n4aa61994sce02724004c27e76@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox