FIX: Microsoft Access/Jet ODBC Driver Returns Size of 2 Gigabytes for Computed Text Columns (272951)
The information in this article applies to:
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.5 SP1
- Microsoft ODBC Driver for Access 4.0
This article was previously published under Q272951 SYMPTOMS
If you use the Microsoft Access (Jet) ODBC driver (Odbcjt32.dll version 4.0.5303.1), which is shipped with Microsoft Windows 2000 Service Pack (SP) 1, when you run statements that contain computed columns of a text data type, a call to the SQLDescribeCol ODBC API on the computed columns returns a column size of 2147483598 (2 GB).
Applications that try to use the column size returned from the call to the SQLDescribeCol ODBC API, to determine how much memory to allocate for the column, fail with "Out of memory" error messages.
Odbcjt32.dll version 4.0.5303.1 is also installed by Microsoft Data Access Components (MDAC) version 2.5, Service Pack 1.
CAUSE
Jet returns a column size of zero for computed columns, which the Jet ODBC driver interprets as an indication of a Long data type. Because of this, the Jet driver sets the column size to the maximum size allowed for Long data types, which is 2 GB. However, if the data type is a text data type (character or varchar) the type is still reported as SQL_VARCHAR, which should have a maximum size of 255.
An example taken from an ODBC trace follows that demonstrates the returned 2 GB column size as the seventh (7th) argument:
mdactest 65c-698 EXIT SQLDescribeCol with return code 0 (SQL_SUCCESS)
HSTMT 01EC18D8
UWORD 2
UCHAR * 0x0012FAE4 [ 8] "Expr1001"
SWORD 129
SWORD * 0x0012FA94 (8)
SWORD * 0x0012FA86 (12)
SQLULEN * 0x0012FA98 (2147483598)
SWORD * 0x0012FA9C (0)
SWORD * 0x0012FA9E (1)
RESOLUTIONTo resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.5. For additional information, click the following article number to view the article in the
Microsoft Knowledge Base:
293312 INFO: How to Obtain the Latest MDAC 2.5 Service Pack
The English version of this fix should have the following file attributes or later:
Date Version Size File name
-----------------------------------------------------------
08/29/00 4.0.5629.0 270,608 bytes Odbcjt32.dll
NOTE: This hotfix is not included with either Jet SP5 or MDAC 2.6. Although the fix is expected to be included with MDAC 2.5 SP2, systems experiencing this problem must apply the hotfix to resolve this problem until MDAC 2.5 SP2 is released. Additionally, systems that are upgraded directly from MDAC 2.5 SP1 to MDAC 2.6 should also have this hotfix applied.
WORKAROUND
In some cases, it may be possible to wrap the calculated field in a datatype conversion function such as CInt or CLng, which converts the results to a non-text datatype.
STATUSMicrosoft 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 Data Access Components 2.5 Service Pack 2.
Modification Type: | Major | Last Reviewed: | 4/7/2006 |
---|
Keywords: | kbQFE KBHotfixServer kbBug kbDatabase kbfix kbJET kbMDAC250SP2fix kbMDACNoSweep KB272951 |
---|
|