Re: Clarification on thread-safety

From: Lachezar Dobrev <l(dot)dobrev(at)gmail(dot)com>
To: Martin Pärtel <martin(dot)partel(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Clarification on thread-safety
Date: 2022-05-27 08:59:43
Message-ID: CA+xsaB3wj7MQbtBtp-6s-Qvt_MorbWZpF4dWLnvCdU8cOX__2w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The term "The PostgreSQL™ JDBC driver" refers to the project as a
whole. Obviously certain classes and methods *may* be (inherently)
thread-safe, but "The PostgreSQL™ JDBC driver" project is not
developed for a multi-threaded use, and the majority of the
functionality (Connections, Statements, Result Sets, etc.) can *only*
be used by a single thread.

На пт, 27.05.2022 г. в 10:24 ч. Martin Pärtel <martin(dot)partel(at)gmail(dot)com> написа:
>
> The docs have a very brief page on thread-safety: https://jdbc.postgresql.org/documentation/head/thread.html
> It states, pretty categorically: "The PostgreSQL™ JDBC driver is not thread safe".
> However, it's common to want to open new connections from multiple threads.
>
> A cursory look at `PGSimpleDataSource` and `org.postgresql.Driver.connect` suggests both of these methods are thread safe.
> Perhaps this is an "obvious" level of thread-safety, but I think the doc page spelling it out would save other paranoid folks like me some time.
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sven Diedrichsen 2022-05-27 14:02:18 [pgjdbc/pgjdbc] ab803c: Made utcTz static and renamed to UTC_TIMEZONE (#2519)
Previous Message Lachezar Dobrev 2022-05-27 08:40:00 Re: issue #2520 (incorrect base type from getUDTs)