Re: getNotifications

Поиск
Список
Период
Сортировка
От kfan
Тема Re: getNotifications
Дата
Msg-id 1345220585174-5720235.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: getNotifications  (Maciek Sakrejda <m.sakrejda@gmail.com>)
Ответы Re: getNotifications
Список pgsql-jdbc
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<notifications.length; i++) {
                  System.out.println("Got notification: " +
notifications[i].getName());
               }
            }
...





--
View this message in context: http://postgresql.1045698.n5.nabble.com/getNotifications-tp5720228p5720235.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Re: getNotifications
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Re: getNotifications