title: Is Postgres JDBC driver `org.postgresql.ds.PGSimpleDataSource` thread-safe?
body: <p>In the <a href="https://jdbc.postgresql.org" rel="nofollow noreferrer">JDBC driver for Postgres</a>, is <a href="https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/PGSimpleDataSource.html" rel="nofollow noreferrer"><code>PGSimpleDataSource</code></a> thread-safe?</p>
  
  <p>That is, if I use a cached singleton instance of that class, can I pass it out to multiple threads? Each thread may be calling <a href="https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/common/BaseDataSource.html#getConnection--" rel="nofollow noreferrer"><code>getConnection</code></a> at the same moment. The documentation makes no mention of thread-safety.</p>
  
  <p>I am trying to avoid both (a) making multi-threaded calls on a <code>Connection</code> and (b) using a connection pool, as <a href="https://jdbc.postgresql.org/documentation/94/thread.html" rel="nofollow noreferrer">discussed in the doc</a>. I want a separate <code>Connection</code> for each servlet thread.</p>