Re: LISTEN/NOTIFY with JDBC - Mailing list pgsql-general

From Kris Jurka
Subject Re: LISTEN/NOTIFY with JDBC
Date
Msg-id Pine.BSO.4.56.0405130345490.31359@leary.csoft.net
Whole thread Raw
In response to Re: LISTEN/NOTIFY with JDBC  (Glenn Sullivan <glenn.sullivan@varianinc.com>)
List pgsql-general

On Wed, 12 May 2004, Glenn Sullivan wrote:

> Thanks for the response.  I have been using Sun's JDBC.
> Do I take it that I need to create and use the Postgres
> JDBC to get the ability to do NOTIFY/LISTEN?
>

You have been using the JDBC API provided by Sun as a number of interfaces
(java.sql.*) which are implemented behind the scenes by the postgresql
JDBC driver in concrete classes.  Listen/Notify is a postgresql extension
not covered in the standard java.sql.* API, so must cast the standard
interfaces to postgresql implementations so that you can access the
additional functionality provided.

For example when using the postgresql JDBC driver java.sql.Connection is
actually an instance of org.postgresql.PGConnection, so you can cast your
Connection to a PGConnection to use the notification API.  Unfortunately
the PGConnection and other extensions are either poorly documented or
completely undocumented.  Combining my example with a brief look at the
source code for PGConnection and PGNotification should hopefully get you
going.

Kris Jurka

pgsql-general by date:

Previous
From: "Stijn Vanroye"
Date:
Subject: Re: Cancel query based on a timeout
Next
From: Jan Poslusny
Date:
Subject: Re: Functionality in database or external langauge