Set ConnObject = NOTHING?

Results 1 to 2 of 2

Thread: Set ConnObject = NOTHING?

  1. #1
    Join Date
    Dec 1969

    Default Set ConnObject = NOTHING?

    I have read in many articles that you MUST close your connection object as soon as possible and then set it to NOTHING. I have found that by closing the connection, you are releasing the connection to the connection Pool. However, Setting the connection to NOTHING seems to destroy the object and not release it to the pool at all. <BR><BR>I did a test by running a small site with approx. 10 connections. In the first test I closed the connection Object but I didn&#039t set it to NOTHING. After running SQL Trace I found that only one connection had been made.<BR><BR>In my next test, I ran the exact same site only this time I set the connection Object to NOTHING after closing it. My results in SQL Trace was that I had Created 10 seperate connections.<BR><BR>More interesting, the speed in my first test took about 25% of the time as the second test.<BR><BR>Someone please enlighten me.

  2. #2
    Jason Miller Guest

    Default What I've read about Nothing...

    Based on one of those "oddly named and repeatedly renamed" MSDN columns talking about why we should all have W2K right now, I would guess that this is because IIS 4.0 doesn&#039t properly handle the "Nothing" setting. It knows that the object should be destroyed & released, but doesn&#039t actually do it until the page is done being served. The article stated that this was the case for COM objects; I suspect that it applies to most objects. The article also stated that this was fixed in IIS 5.0, <BR><BR>&#060;tongue src=cheek&#062;so run out and upgrade to W2K today, only $180 for the workstation upgrade!&#060;/tongue&#062;<BR><BR>Generally, connecting to a database takes the most time of any db operation, so you should only connect once per page per database, but as soon as you&#039re done with your db calls, you should kill the connection -- even if you don&#039t have W2K yet.

Posting Permissions

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