Re: JDBC issue - 2 ResultSets getting data via a single Connection -the date functions interact.

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: JDBC issue - 2 ResultSets getting data via a single Connection -the date functions interact.
Дата
Msg-id CADK3HHLsYWHSCAo2nYcn7dXMBMPn7rYiqrUCD=NOvhm96AvoJA@mail.gmail.com
обсуждение исходный текст
Ответ на JDBC issue - 2 ResultSets getting data via a single Connection - thedate functions interact.  (David Irving <David.Irving@hssnet.com>)
Список pgsql-bugs
You can't share connections, and or result sets across threads. The driver is not thread safe

Dave Cramer

On 22 March 2018 at 07:09, David Irving <David.Irving@hssnet.com> wrote:

Hi,

I am not sure if this is a real bug, as one should not access 2 ResultSets from the same connection at the same time from different threads.

 

But that is the legacy code I am looking at.

 

I have 2 ResultSet getDate(…) calls taking place in different threads.

The ResultSet calls getConnection().getTimestampUtils()…

 

And then gets the TimestampUtils convertDate or getDateBin() type functions.

These are not synchronized, so I am getting data from 1 result set turning up in the getDate() function on the other ResultSet running in the other thread.

 

Not sure if this is something you would like to fix, due to the non-standard way of working,  but here is the TimestampUtils.java  I modified to test the code.

 

I added a method…

  public static boolean isCrisVersion() {

      return true;

  }

To check I was loading a separate version of the TimestampUtils.

 

Dave Irving

Healthcare Software Services.

 

P.S The JDBC driver I was using was 42.2.2 released a few days ago.

The information contained in this message is confidential and is intended for the addressee only. If you are not the addressee, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. Any views or opinions presented are those of the sender and do not necessarily represent the Wellbeing Software Group. Wellbeing Software Ltd is a company registered in England and Wales with company number 07925070.

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

Предыдущее
От: Ezequiel Post
Дата:
Сообщение: Re: BUG #15125: Cant set ApplicationName in Java...
Следующее
От: Andres Freund
Дата:
Сообщение: Re: BUG #15121: Multiple UBSAN errors