Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: ADO Client Cursor Engine Leaks Memory If Provider Does Not Support Some DBPROP or Rowset Properties


View products that this article applies to.

This article was previously published under Q322149

↑ Back to the top


Symptoms

The ADO Client Cursor Engine may leak memory when you use it with a custom, third-party OLE DB provider. The leak occurs if the custom provider does not support some common OLE DB properties in the DPROPSET_DATASOURCEINFO and DBPROPSET_ROWSET property sets, including the following properties:
  • DBPROP_DBMSNAME
  • DBPROP_MULTIPLERESULTS
  • DBPROP_PROVIDERNAME
  • DBPROP_SCHEMATERM
  • DBPROP_COMMANDTIMEOUT
  • DBPROP_USERNAME
  • DBPROP_IRowsetChange
  • DBPROP_IRowsetUpdate
If custom providers return DB_E_ERRORSOCCURRED when the ADO Client Cursor Engine calls the IRowsetInfo::GetProperties or the IDBProperties::GetProperties method for these properties, the ADO Client Cursor Engine leaks memory.

This problem does not occur if the GetProperties call succeeds. Therefore, the ADO Client Cursor Engine may leak memory if all of the following conditions are true:
  • Your custom provider does not support any of the properties that are listed earlier in this section.
  • Your custom provider returns DB_E_ERRORSOCCURRED when the ADO Client Cursor Engine calls IRowsetInfo::GetProperties or IDBProperties::GetProperties.

↑ Back to the top


Cause

The "IRowsetInfo::GetProperties" and the "IDBProperties::GetProperties" topics of the OLE DB specification state that if the provider returns DB_E_ERRORSOCCURRED for a particular property, the client should free these properties. The ADO Client Cursor Engine does not release this memory for some properties.

↑ Back to the top


Resolution

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211� INF: How to Obtain the Latest SQL Server 2000 Service Pack

MDAC 2.7

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Version       Size     File name     Platform
   -----------------------------------------------------------
   May-13-2002  2.70.8713.0   307,200  Msadce.dll    x86
				

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.

↑ Back to the top


More information

If your provider does not support all of the properties that are listed in the "Symptoms" section of this article, you can use the following code to reproduce the leak:
Private Sub Command1_Click()
    For i = 1 To 10
        Test
    Next
    MsgBox "Done"
End Sub

Sub Test()
    Dim cn As String
    Dim query As String
    Dim connection As New ADODB.connection
    Dim rs As ADODB.Recordset
    Set rs = CreateObject("ADODB.Recordset")

    cn = "Provider=YOURPROVIDER;UID=YourUID;PWD=YourPassword"
    query = "Select * FROM AnyTable"
        rs.CursorLocation = adUseClient
        connection.Open cn        
        For i = 1 To 1000
          rs.Open query, connection, adOpenDynamic, adLockPessimistic
          rs.Close
        Next
        connection.Close
End Sub
				

↑ Back to the top


Keywords: kbbug, kbfix, kbsqlserv2000presp3fix, kbqfe, kbsqlserv2000sp3fix, kbhotfixserver, KB322149

↑ Back to the top

Article Info
Article ID : 322149
Revision : 5
Created on : 9/27/2005
Published on : 9/27/2005
Exists online : False
Views : 368