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

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: David Irving <David(dot)Irving(at)hssnet(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: JDBC issue - 2 ResultSets getting data via a single Connection - the date functions interact.
Date: 2018-03-22 20:36:04
Message-ID: CADK3HHLsYWHSCAo2nYcn7dXMBMPn7rYiqrUCD=NOvhm96AvoJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Irving(at)hssnet(dot)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.
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2018-03-22 23:34:39 Re: BUG #15121: Multiple UBSAN errors
Previous Message Ezequiel Post 2018-03-22 16:53:47 Re: BUG #15125: Cant set ApplicationName in Java...