max connections - Mailing list pgsql-jdbc

From Simon Stanlake
Subject max connections
Date
Msg-id HAEJICIELCMBEJEIAMMACEDFCGAA.stanlake@hi.ca
Whole thread Raw
Responses Re: max connections  (Rene Pijlman <rene@lab.applinet.nl>)
List pgsql-jdbc
Hi,

The documentation states that the Connection object is thread-safe... I took
this to mean I can create a connection as a singleton and pass it out to all
my threads with no worries.  When I did this I noticed that a
SimpleObjectPool was being created, and I would occasionally get a "max
connections exceeded" error from the database.  I assume this means the
implementation actually creates a connection pool and passes connections out
to threads as needed.

My question is... what is the proper way to handle postgres connections in a
multithreaded environment?  is it OK to create a singleton of the
connection?  if so, is there a way to limit the number of connections the
pool makes to the database so that the maximum is not exceeded?
_______________________________
Simon Stanlake
Harmony Integrated Systems Inc.
http://www.hi.ca


pgsql-jdbc by date:

Previous
From: Liam Stewart
Date:
Subject: Re: Status of JDBC test suite?
Next
From: "Thomas O'Dowd"
Date:
Subject: Re: Escape Processing problems