Re: max connections - Mailing list pgsql-jdbc

From Rene Pijlman
Subject Re: max connections
Date
Msg-id 7jq1pt8gquito8q8hpo1jur313vua61j7s@4ax.com
Whole thread Raw
In response to max connections  ("Simon Stanlake" <stanlake@hi.ca>)
List 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@lab.applinet.nl>

pgsql-jdbc by date:

Previous
From: Rene Pijlman
Date:
Subject: Re: ? (question mark) characters
Next
From: Rene Pijlman
Date:
Subject: Re: Re: Proposal to fix Statement.executeBatch()