Connection Object

Results 1 to 2 of 2

Thread: Connection Object

  1. #1
    Join Date
    Dec 1969

    Default Connection Object

    I am creating an asp application that consists of several different asp pages. Instead of including: <BR>Dim conn<BR>set conn=CreateObject("ADODB.Connection")<BR>conn.prov ider..........etc. then defining the connection string and finally opening it, and then having at the end of every page:<BR>conn.close<BR>set conn=nothing<BR><BR>Can I just define and open the connection when the user initially logs into the application, and close the connection when a user logs out rather than on every single page??? That way I would be able to use the connection eg. conn.Execute(...) on all the in-between pages without having to constantly include this code????

  2. #2
    Join Date
    Dec 1969

    Default *NO*!

    Even if you *could* do this, you would never want to!<BR><BR>You are only allocated a limite number of connections, and once they were all allocated to single users then nobody else could do any DB work.<BR><BR>Aside from the tiny bit of extra typing you have to do (and even that you could cut and paste) there&#039;s not much overhead involved, thanks to something called "Connection Pooling" where if you re-use the same named connection (that is, a connection to the same DB with the same privileges, which is almost always what happens with ASP/ADO) the system just re-uses a connection out of a "pool."<BR><BR>So don&#039;t even *THINK* in that direction.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts