IIS leaving too many SQL db connections

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default IIS leaving too many SQL db connections

    Greetings.

    I have a site with several pages that connect to a SQL
    2000 database with a connection string stored in a session
    variable. After navigating through a number of pages with
    database access, there are a plethora of database
    connections left open on the server. This is an IIS 5
    site on a W2K going against a SQL 2K database on the same
    server. I do all of the proper things, such as:
    Dim cn
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.ConnectionString = Session("CString")
    cn.Open
    ' do stuff with recordset or whatever
    cn.Close
    Set cn = Nothing

    What can I do to avoid all of these connections? In my
    testing, I can get it up to 9 just as a single user in a
    test environment. But I have another install where they
    proclaim 26 connections.

    Is this the OLE DB connection pooling figuring that I need
    that many connections? It seems a wee bit excessive.

    Thanks.
    Dale Mumper Guest

  2. Similar Questions and Discussions

    1. Delete record without leaving orphans
      I have 2 MS access tables "links" and "linkCategory" where links get assigned to a category for display. I want to be able to delete a...
    2. Detect leaving page
      Looking for a method to detect when the user presses the "Back" button and also Alt+> Thanks for any insight! Kevin
    3. Leaving bookmarks open when going to a new page
      My bookmarks are visible when I OPEN the document, but when I click on a bookmark to go to a different page, they close. I have to click the...
    4. Detect for cursor leaving stage
      Hey all - I have a menusystem that needs to know if the cursor has left the stage. Is there any code that will do the trick? Right now I have...
    5. What are the dangers of leaving a cgi-bin directory CHMOD 777
      I have a perl script that writes to its directory, and as such the directory is CHMOD 777 in my cgi-bin. (Linux box) I figured this might be...
  3. #2

    Default Re: IIS leaving too many SQL db connections

    > Set cn = Server.CreateObject("ADODB.Connection")
    > cn.ConnectionString = Session("CString")
    Does this connection string change per user? If not, use a single
    connection string in an application variable. If you use session level,
    then if you have a user with cookies disabled, they will start a new session
    on each page...
    > Is this the OLE DB connection pooling figuring that I need
    > that many connections? It seems a wee bit excessive.
    Is this causing a problem, or is the app behaving fine and you are just
    being highly analytical?


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: IIS leaving too many SQL db connections

    > It's not causing a performance issue at this point, so it
    > is being somewhat analytical. I was just amazed that what
    > I thought was sound code was leaving so much trash around.
    Idle connections are not exactly "trash"... a new user picking up an idle
    connection is much more efficient than the overhead of initiating a brand
    new connection from the database.

    Let connection pooling do its work. Worry about it when it becomes an
    issue.
    > And as far as setting cn.ConnectionString, I guess that
    > old habits die hard. I probably will start doing it your
    > way, though. Less typing makes me happy.
    Okay, then see some shorter versions of connection strings. :-)
    [url]http://www.aspfaq.com/2126[/url]


    Aaron Bertrand - MVP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139