ADO Interop - SQL Server 2000 connections not released

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: scotthibbs (scotthibbs_at_discussions.microsoft.com)
Date: 08/15/04


Date: Sun, 15 Aug 2004 07:01:03 -0700

We have an application that uses the following:
   - ASP
   - COM+ components to make data calls via ADODB
   - DB is SQL Server 2000

Here is the common connection VB code:
        cn = New ADODB.Connection
        With cn
            .Provider = "SQLOLEDB.1"
            strConnect = "User ID=xxxxxx;Password=xxxx;Persist Security
Info=False;Initial Catalog=" & Database & ";Data Source=" & SQLServer & ";OLE
DB Services=-1"
            .ConnectionString = strConnect
            .CursorLocation = ADODB.CursorLocationEnum.adUseServer
            .ConnectionTimeout = 10
            .Open()
        End With

When the ASP page is executed...no matter how many calls to the COM+
component..the number of connections to the database stays less than 10 for a
single user. I would expect this behavior since we are specifying ADO
connection pooling (OLE DB Services=-1). We also have confirmend that all
objects, connections, recordsets, etc. are properly set to nothing upon exit.

We now have converted the ASP pages to ASP.NET. The COM+ component has been
converted to .NET...using Interop to continue calling ADODB. ADO.NET does
not have some of the needed functionality..particularly the GetRows() method
we depend on heavily. The ASP.NET page is structured the same as ASP...i.e.
no codebehind.

The problem is that the ASP.NET pages drive the number of connections
with the SQL server to an extraordinary number.....hundreds or thousands for
a single user. I constructed a test page where I repeatedly call the
component 100 times. The connections to SQL Server 2000 continually increase
every time I hit the page. The connections seem to reach some sort of
maximum, but it is not consistent....usually around 500 connections. The
connections will drop off very slowly after 10 or 20 minutes...sometimes
longer.

We have tried OLE DB Services=-4 to disable connection pooling and the
result is very "spiky" connection behavior at the SQL Server...as one would
expect. This, however, would not be an option if we had a production
workload of thousands of users. The server would be too busy without pooling
(-4)....and run out of memory if we turn pooling (-1) back on.



Relevant Pages

  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... connections need to be returned to the pool to be ... Enterprise version of SQL Server 2000. ... server user login to be sure that it is not mixed with other running clients). ... Every new client opens again 30 connections if I open 30 tables ...
    (microsoft.public.sqlserver.connect)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... an Access database in former times this was a lot of work which took me ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... client for programming easy, fast and good applications. ...
    (microsoft.public.sqlserver.connect)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I think it will ameliorate the situation if you clean up the client as ... And to come back to my problem: I think with help of the SQL Server admins ... closed connections - but all of these errors are in the version which used ... Every new client opens again 30 connections if I open 30 tables ...
    (microsoft.public.sqlserver.connect)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... And to come back to my problem: I think with help of the SQL Server admins ... closed connections - but all of these errors are in the version which used ... communication between ODBC (OLEDB and Native Client, ... Every new client opens again 30 connections if I open 30 tables ...
    (microsoft.public.sqlserver.connect)
  • Re: SQL server connection problem
    ... I've tried to change the user connections to 0, ... "SQL server connection time out. ... The following message appears when restart the server and before login ... I receive Error message: “A connection could not be established to ...
    (microsoft.public.sqlserver.clients)