Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T2PKG-0005zG-4Z for pgsql-jdbc@postgresql.org; Fri, 17 Aug 2012 16:23:08 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T2PKE-0005PS-MC for pgsql-jdbc@postgresql.org; Fri, 17 Aug 2012 16:23:07 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1T2PKD-00015c-5p for pgsql-jdbc@postgresql.org; Fri, 17 Aug 2012 09:23:05 -0700 Date: Fri, 17 Aug 2012 09:23:05 -0700 (PDT) From: kfan To: pgsql-jdbc@postgresql.org Message-ID: <1345220585174-5720235.post@n5.nabble.com> In-Reply-To: References: <1345217428484-5720228.post@n5.nabble.com> Subject: Re: getNotifications MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.3 (/) X-Archive-Number: 201208/38 X-Sequence-Number: 23193 Thank you for the assistance. It's not an exception, it's a compile error. I am casting the connection object to a PGConnection...interesting to note though that the methods available on the PGConnection object only shows the addDatatype method. the error: the method getNotifications() is undefined for type PGConnection. What I see now is PGNotification is not available but PGConnection is...not sure I saw that earlier. Where is that class? Thought it was part of the same package. The code is something I found online: import java.sql.*; ... Listener(Connection conn) throws SQLException { this.conn = conn; this.pgconn = (org.postgresql.PGConnection)conn; Statement stmt = conn.createStatement(); stmt.execute("LISTEN mymessage"); stmt.close(); } public void run() { while (true) { try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT 1"); rs.close(); stmt.close(); org.postgresql.PGNotification notifications[] = pgconn.getNotifications(); if (notifications != null) { for (int i=0; i