Skip site navigation (1) Skip section navigation (2)

max connections

From: "Simon Stanlake" <stanlake(at)hi(dot)ca>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: max connections
Date: 2001-08-29 21:38:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

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.


pgsql-jdbc by date

Next:From: Rene PijlmanDate: 2001-08-29 21:55:30
Subject: PostgreSQL/JDBC Test Suite Howto
Previous:From: Liam StewartDate: 2001-08-29 18:16:50
Subject: Re: Status of JDBC test suite?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group