Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Re: DB Connections


Message #1 by "Michael Mckenzie" <michael@e...> on Mon, 25 Jun 2001 06:22:32
Hi,

According to wrox asp 3.0 progs. ref.(Page 1069)  you should consider 

opening the DB in global.asa.

in app_onstart, create a connection string. In session_onstart, create 

record sets etc.

I don't see how leaving a connection open til the end of a page is gunna 

slow anything down. The most important issue is to make the pages easy to 

write, understand and maintain.



Mike











> 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