Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: DB Connections


Message #1 by "Peter Lanoie" <planoie@e...> on Tue, 3 Apr 2001 13:36:42 -0400
Tap tap, is this list on??  Haven't seen much on it.



On to the discussion topic:



After following many threads on various lists regarding DB connections I

started thinking of the suggestion that most people make.  That classic

"Open late, close early."  What I'm wondering about is this scenario:

You have a site that is built around a very simple script template.  Each

separate page, that is, consists of a very simple script with some includes

and perhaps a function call.  The include files however are much more

complex.  They comprise all the pieces that build the "shell", if you will,

of the site, and the individual - and simpler - scripts contain the page's

content.  In many cases, you will need to hit a DB at some (and possibly

several) points for various things.



So, this raises the question relating to the aforementioned recommendation:

Do we open at the beginning of our "shell" and close at the end, making

available a common DB connection object to any needed calls, or do we open

and close a connection object as close as possible to where we actually make

these calls?  What is the expense comparison between a connection object

that is alive and kicking for the life of the whole script and a series of

quick open/closes that may occur a significant number of times?



My thought is that the former is better. A single connection that lives for

the whole script's life.



Options, ideas, flames?



Peter





-----------------------------

Test your post for discussion

compliance: Run a spellcheck.

-----------------------------




  Return to Index