pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL_db_change_notification
2+ messages / 2 participants
[nested] [flat]

* PostgreSQL_db_change_notification
@ 2009-07-06 17:57 iceDice <nmilasinovic@gmail.com>
  2009-07-06 18:27 ` Re: PostgreSQL_db_change_notification Greg Stark <gsstark@mit.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: iceDice @ 2009-07-06 17:57 UTC (permalink / raw)
  To: pgsql-jdbc


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.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PostgreSQL_db_change_notification
  2009-07-06 17:57 PostgreSQL_db_change_notification iceDice <nmilasinovic@gmail.com>
@ 2009-07-06 18:27 ` Greg Stark <gsstark@mit.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Stark @ 2009-07-06 18:27 UTC (permalink / raw)
  To: iceDice <nmilasinovic@gmail.com>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2009-07-06 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-07-06 17:57 PostgreSQL_db_change_notification iceDice <nmilasinovic@gmail.com>
2009-07-06 18:27 ` Greg Stark <gsstark@mit.edu>

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