LISTEN/NOTIFY with JDBC

Поиск
Список
Период
Сортировка
От Glenn Sullivan
Тема LISTEN/NOTIFY with JDBC
Дата
Msg-id 40A14F6B.8090704@varianinc.com
обсуждение исходный текст
Ответы Re: LISTEN/NOTIFY with JDBC  (Kris Jurka <books@ejurka.com>)
Список pgsql-general
Hi,

I have been trying to get LISTEN/NOTIFY working in with JDBC.  I cannot seem
to get notified.  I looked in the e-mail archive and saw a lot of similiar
questions a couple of years ago.  I never could find any answers in the
e-mail nor in the documentation.  Perhaps I just missed it.

I have tried the following code snipit:

Connection db = DriverManager.getConnection(url, user, passwd);
Statement sql = db.createStatement();

sql.execute("LISTEN mytest");
db.clearWarnings();

for(int i=0; i < 10 ; i ++) {
     Thread.sleep(3000);
     SQLWarning warn = db.getWarnings();
     if(warn != null)
         System.out.println("warn: " + warn.getMessage());
     else
         System.out.println("warning null");
}


During the running of this loop, I run "psql" on the same database
and manually execute "NOTIFY mytest;".

"warn" always comes back "null"

Could someone help me figure out what is wrong with this, or point me in
a new direction?

Thanks,

Glenn


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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: How to move data from 1 database to another?
Следующее
От: Alexander Cohen
Дата:
Сообщение: Shared memory segment error