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.

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