Re: max connections

From: Rene Pijlman <rene(at)lab(dot)applinet(dot)nl>
To: "Simon Stanlake" <stanlake(at)hi(dot)ca>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: max connections
Date: 2001-09-01 14:05:33
Message-ID: 7jq1pt8gquito8q8hpo1jur313vua61j7s@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 29 Aug 2001 14:38:21 -0700, you wrote:
>My question is... what is the proper way to handle postgres connections in
>a multithreaded environment?

See
http://www.postgresql.org/users-lounge/docs/7.1/programmer/jdbc-thread.html

>is it OK to create a singleton of the connection?

"If a thread attempts to use the connection while another one is
using it, it will wait until the other thread has finished its
current operation. ...
This is fine for applications and applets but can cause a
performance problem with servlets. With servlets you can have a
heavy load on the connection. If you have several threads
performing queries then each but one will pause, which may not
be what you are after."

>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?

I'm not sure what you mean by that. If you create a singleton
I'd say there is exactly one connection.

Regards,
René Pijlman <rene(at)lab(dot)applinet(dot)nl>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Roger Bjärevall 2001-09-01 15:43:39 Re: Need help with JDBC driver. Problem, - getExportedKeys=
Previous Message Rene Pijlman 2001-09-01 13:48:36 Re: ? (question mark) characters