On Wed, Jun 26, 2002 at 02:19:56PM -0700, Michael A Chase wrote:
> On Wed, 26 Jun 2002 21:42:55 +0100 Rory Campbell-Lange <[EMAIL PROTECTED]> 
>wrote:
> 
> > I have a script which I imagine will loop every 15 to 60 seconds.
> > 
> > Should I make the database connection at the beginning of the script,
> > and just keep reusing it, or would it be more prudent to remake the
> > connection in the body of the loop?
> > 
> > I'm connecting to postgresql on localhost (Linux).
> 
> Much more efficient to keep the connection.  You will want to be sure to
> check for failures caused by losing the connection and either quit or
> recover somehow.

That's almost certainly true.  But keep an open mind if you find
yourself getting into nightmares on the error handling and recovery.
Local database connection is going to be a lot different than a
remote connection through a couple of firewalls and a dozen hops.

> 
> -- 
> Mac :})
> ** I normally forward private questions to the appropriate mail list. **
> Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
> Give a hobbit a fish and he eats fish for a day.
> Give a hobbit a ring and he eats fish for an age.
> 
> 

-- 

Christopher F. Miller, Publisher                               [EMAIL PROTECTED]
MaineStreet Communications, Inc           208 Portland Road, Gray, ME  04039
1.207.657.5078                                         http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux

Reply via email to