Microsoft KB Archive/248417
Article ID: 248417
Article Last Modified on 10/12/2005
- Microsoft Data Access Components 2.1 Service Pack 2
This article was previously published under Q248417
When selecting several large VARCHAR fields that are less than 8 KB in size through the Microsoft OLE DB Provider for ODBC, an 0xc0000094 "Integer division by zero" error occurs and the application throws an access violation. Drastically reducing the number of selected VARCHAR fields eliminates the problem, as does increasing the size of the fields to something over 8 KB.
This problem occurs when using the MDAC 2.1 SP2 version of the provider, namely the Msdasql.dll file version 2.10.4202, but does not occur with earlier versions.
If the rowset that is being generated by the SELECT statement contains numerous large VARCHAR fields, the calculation of the size of the bookmark table is not done correctly and a value of zero is returned. This zero is then used when attempting to divide up the buffer space allocated for the bookmark table into bookmark entries.
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Data Access Components service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this 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 Time Version Size File name Platform ------------------------------------------------------------- 12/10/99 02.12.4810 277KB msdasql.dll 12/10/99 02.12.4810 10KB msdasqlr.dll 12/10/99 02.12.4810 62KB msdatl2.dll 12/10/99 02.12.4810 37KB msdatt.dll
Following are the three workarounds for this problem.
- Use the previous version of the ODBC provider (MSDASQL) from MDAC 2.1 SP1, which is version 2.10.3711.
- If the database you are targeting supports VARCHAR fields larger than 8 KB you can modify the table so that the size of the VARCHAR fields exceed 8 KB.
NOTE: Microsoft SQL Server and Oracle do not support VARCHAR fields larger than 8 KB.
- Reduce the number of large VARCHAR fields in the rowset.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Important You cannot install this hotfix on a computer that is currently running MDAC 2.1 SP1 GA (version 2.10.3711.11) or earlier. You must be using MDAC 2.1 SP2 GA (version 2.10.4202) in order to use this hotfix. Since this hotfix resolves a bug that is only found in the 2.10.4202 version of the ODBC provider, there should be no reason to apply this hotfix to earlier releases.
In order to alleviate memory fragmentation problems, significant code changes were made to the Msdatl2.dll file that this provider is linked with.
If this hotfix is installed on a computer that is running MDAC 2.1 SP1 GA (2.10.3711) or earlier, other providers may fail to load and crashes or other unexpected errors may occur. Please see the "References" section below for more information.
In addition, you must install all 4 files that are included in the hotfix package.
- Close or stop any applications or services that are using any of the files listed above. This may include Internet Information Server (IIS), Microsoft Transaction Server (MTS), Microsoft SQL Server, and any ADO or OLE DB applications.
- Download the hotfix file (Largevarchar.exe) into a temporary directory, and run it to extract the following files:
- Locate and rename the current versions of these files, that should be in the \Program Files\Common Files\System\OLE DB folder.
- Copy the hotfix files into the same location, and then restart your services and applications.
Steps to Reproduce Behavior
Copy the following code into a Visual Basic application; add a reference to the Microsoft ActiveX Data Objects 2.1 Library; compile it; and run it. Notice that an error is thrown when attempting to execute the MoveNext method. Note that your connection string should be changed prior to executing this code.
Note You must change User ID=<username> and password = to the correct values before you run this code. Make sure that User ID has the appropriate permissions to perform this operation on the database.
Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim DropTable As String, CreateTable As String, AppendTable1 As String, AppendTable2 As String 'DropTable = "Drop table LongFields" 'Not needed for first execution CreateTable = "CREATE TABLE LongFields ([key] [int] IDENTITY (1, 1) NOT NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL ,  [varchar] (7000) NULL ," & _ " [varchar] (7000) NULL ,  [varchar] (7000) NULL)" AppendTable1 = "Insert into LongFields values ('abc', 'abc', 'abc', 'abc', 'abc'," & _ "'abc', 'abc', 'abc', 'abc', 'abc'," & _ "'abc', 'abc', 'abc', 'abc', 'abc'," & _ "'abc', 'abc', 'abc', 'abc', 'abc')" AppendTable2 = "Insert into LongFields values ('xyz', 'xyz', 'xyz', 'xyz', 'xyz'," & _ "'xyz', 'xyz', 'xyz', 'xyz', 'xyz'," & _ "'xyz', 'xyz', 'xyz', 'xyz', 'xyz'," & _ "'xyz', 'xyz', 'xyz', 'xyz', 'xyz')" conn.CursorLocation = adUseServer conn.Open "DSN=Pubs;User Id=<username>;Password=<strong password>;Database=Pubs;" 'conn.Execute DropTable 'Not needed for first execution conn.Execute CreateTable conn.Execute AppendTable1 conn.Execute AppendTable2 rs.ActiveConnection = conn rs.Properties("Hold Rows") = True rs.CursorType = adOpenKeyset rs.Open "select * from LongFields" rs.MoveNext '<--- Code fails here rs.Close conn.Close End Sub
For additional information about the memory fragmentation issue referenced above, click the article number below to view the article in the Microsoft Knowledge Base:
230101 Data Queries Sporadically Return Empty Recordsets
Additional query words: integer divide by zero av crash bookmark hold rows large varchar fields
Keywords: kbbug kbfix kboledb210fix kbprovider kbqfe kbdatabase kbhotfixserver KB248417