Leaving a dbase connection open ?

Results 1 to 3 of 3

Thread: Leaving a dbase connection open ?

  1. #1
    Join Date
    Dec 1969

    Default Leaving a dbase connection open ?

    My collegue has critised me because I always close a database connection. Now every manual I have read states that a connection should ALWAYS be closed and set to nothing after you&#039re done. We use Access databases. I leave the connection open if I have to open multiple databases on one page, but I always close at the end of an asp page. Is he right and are all the manuals wrong ?

  2. #2
    gfdgfdssfd Guest

    Default RE: Leaving a dbase connection open ?

    You should always close a connection and destroy the object when you are done with it.

  3. #3
    Join Date
    Dec 1969

    Default RE: Leaving a dbase connection open ?

    your colleague is wrong. opening a database connection is a very costly procedure in terms of resources. to get round this, ADO uses something called connection pooling. when you close and destroy a connection object, it isn&#039t literally destroyed, but returned to the pool. <BR><BR>So if you return the object to the pool, it may save the server having to create another connection, which can only be a good thing.<BR><BR>I actually recommend using getRows on your recordset objects, and killing the connection immediately, like so<BR><BR>set conn=server.createobject ("ADODB.connection")<BR>conn.open connectstring<BR>set rs=Conn.Execute ("getEquip "&session("ProfileID"))<BR>eArray=rs.GetRows()<BR> rs.close<BR>set rs = nothing<BR>conn.close<BR>set conn=nothing<BR><BR>... do stuff here<BR><BR>because then there is the minimum amount of time with the connection open possible. you were right in mentioning keeping a conn open for multiple recordsets in a page, though, but it should be killed off asap<BR><BR><BR>jason

Posting Permissions

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