[JDBC] Documentation on NOTIFY/LISTEN is misleading

Поиск
Список
Период
Сортировка
От Daniel Migowski
Тема [JDBC] Documentation on NOTIFY/LISTEN is misleading
Дата
Msg-id 41ED3F5450C90F4D8381BC4D8DF6BBDCAF69CAC9@EXCHANGESERVER.ikoffice.de
обсуждение исходный текст
Список pgsql-jdbc

Hello,

 

I found the example code in the documentation of the JDBC driver is misleading. The example receiving code displayed on https://jdbc.postgresql.org/documentation/head/listennotify.html issues a SELECT 1 everytime before it checks for notifications, which made me believe the driver is not able to receive notifications without having to hit the database.

 

After checking the source (because I tried to implement something that does not have this requirement) I found out this select is useless at least in the current state of the driver, which makes the drivers implementation much more appealing to me. Please remove the seven lines

 

                // issue a dummy query to contact the backend
                // and receive any pending notifications.

 

                Statement stmt = conn.createStatement();

                ResultSet rs = stmt.executeQuery("SELECT 1");

                rs.close();

                stmt.close();

 

from the example code.

 

Regards,

Daniel Migowski

 

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

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: [pgjdbc/pgjdbc] 9c80ad: fix: make sure org.postgresql.Driver isloaded whe...
Следующее
От: Jorge Solorzano
Дата:
Сообщение: [JDBC] [pgjdbc/pgjdbc] 3f2a02: test: check that new properties followcorrect low...