Hi y'all,
	Is it a bad idea for an app to keep just a couple of connections to a
database, put semaphore/mutex on them and reuse them all through the program?
	Of course I would check if their PQstatus isnt at CONNECTION_BAD and
reconnect if they were...
	I need some opinions on that practice...
	
						Thanks
						  -Mat

-- 
Mathieu Dube	
Mondo-Live			
www.flipr.com

Tue, 6 Feb 2001 11:08:49 -0500
Mathieu Dube <mathieu_dube@videotron.ca>
using the same connection?
On Tue, Feb 06, 2001 at 11:08:49AM -0500, Mathieu Dube wrote:
> Hi y'all,
> 	Is it a bad idea for an app to keep just a couple of connections to a
> database, put semaphore/mutex on them and reuse them all through the program?
> 	Of course I would check if their PQstatus isnt at CONNECTION_BAD and
> reconnect if they were...

You would have to hold the lock from BEGIN until COMMIT.
Otherwise, connection re-use is normal.  

Nathan Myers
ncm@zembu.com

Tue, 6 Feb 2001 11:04:06 -0800
ncm@zembu.com (Nathan Myers)
Re: using the same connection?
Well actually this particular connection is just for selects...

On Tue, 06 Feb 2001, you wrote:
> On Tue, Feb 06, 2001 at 11:08:49AM -0500, Mathieu Dube wrote:
> > Hi y'all,
> > 	Is it a bad idea for an app to keep just a couple of connections to a
> > database, put semaphore/mutex on them and reuse them all through the program?
> > 	Of course I would check if their PQstatus isnt at CONNECTION_BAD and
> > reconnect if they were...
> 
> You would have to hold the lock from BEGIN until COMMIT.
> Otherwise, connection re-use is normal.  
> 
> Nathan Myers
> ncm@zembu.com
-- 
Mathieu Dube	
Mondo-Live			
www.flipr.com

Tue, 6 Feb 2001 14:15:22 -0500
Mathieu Dube <mathieu_dube@videotron.ca>
Re: using the same connection?
Quoting Mathieu Dube <mathieu_dube@videotron.ca>:

> Hi y'all,
> 	Is it a bad idea for an app to keep just a couple of connections to a
> database, put semaphore/mutex on them and reuse them all through the
> program?
> 	Of course I would check if their PQstatus isnt at CONNECTION_BAD and
> reconnect if they were...
> 	I need some opinions on that practice...

In the Java world it's called ConnectionPooling and is standard practice, 
especially with Servlets/JSP/EJB's.

Peter

-- 
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

Wed, 07 Feb 2001 03:37:48 -0500 (EST)
Peter T Mount <peter@retep.org.uk>
Re: using the same connection?