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 <[EMAIL PROTECTED]>

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to