Microsoft KB Archive/277033

= FIX: SQL_BIGINT in 2.x ODBC Driver Is Mapped to SQL_C_SBIGINT 3.0 Datatype =

Article ID: 277033

Article Last Modified on 9/26/2005

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft OLE DB Provider for ODBC 2.0
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.5 Service Pack 1
 * Microsoft Data Access Components 2.6
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.5

-



This article was previously published under Q277033



SYMPTOMS
When the Microsoft OLEDB Provider for ODBC driver (MSDASQL) is using an ODBC driver that is ODBC 2.x compliant, and the driver reports a SQL_BIGINT datatype (-5), the ODBC provider (MSDASQL) chooses a C datatype of SQL_C_SBIGINT for use in the SQLBindCol ODBC API function. However, because SQL_C_SBIGINT is an ODBC 3.x datatype, this generates the following error from the ODBC Driver Manager:

S1003 [Microsoft][ODBC Driver Manager] Driver does not support this parameter

This problem occurs in all releases of the ODBC provider (Msdasql.dll) version 2.50.4403.6 (MDAC 2.5 RTM) and later.



CAUSE
When the ODBC provider first loads and uses an ODBC driver, the driver is queried to see what version of ODBC it supports, 2.x or 3.x. This information is stored in the connection handle class.

The provider keeps internal structures to do the datatype mapping between SQL datatypes (such as SQL_CHAR) and C datatypes (such as SQL_C_CHAR). The provider is not checking the version that it stored for the ODBC driver before performing the SQL-to-C datatype mapping, and simply maps the SQL datatype of SQL_BIGINT to an ODBC 3.x datatype of SQL_C_SBIGINT. This datatype is not recognized in an ODBC 2.x driver, and causes the ODBC Driver Manager to produce an error.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft MDAC 2.5. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

293312INFO: How to Obtain the Latest MDAC 2.5 Service Pack

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack

Hotfix
The P1 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.

MDAC 2.5 English   Date         Version            Size    File name --  01/31/2001   2.53.6131.0     303,376    Msdasql.dll 01/31/2001  2.53.6131.0      16,384    Msdasqlr.dll 01/31/2001  2.53.6131.0      78,096    Msdatl2.dll 01/31/2001  2.53.6131.0      53,520    Msdatt.dll 03/14/2001                  473,280    Q277033_W2K_SP3_x86_en.EXE MDAC 2.5 French   Date         Version            Size     File name ---  01/31/2001   2.53.6131.0     303,376     Msdasql.dll 02/14/2001  2.53.6131.0      16,384     Msdasqlr.dll 01/31/2001  2.53.6131.0      78,096     Msdatl2.dll 01/31/2001  2.53.6131.0      53,520     Msdatt.dll 02/28/2001                  484,408     Q277033_w2k_sp3_x86_FR.EXE MDAC 2.6 English   Date         Version            Size      File name ---  01/31/2001   2.61.7131.0     311,568      Msdasql.dll 01/31/2001  2.61.7131.0      16,384      Msdasqlr.dll 01/31/2001  2.61.7131.0      94,480      Msdatl3.dll 01/31/2001  2.61.7131.0      24,848      Msdatt.dll 03/05/2001                  269,312      Q277033_MDAC26_SP1_x86_en.exe MDAC 2.6 French   Date         Version            Size      File name 01/31/2001  2.61.7131.0     311,568      Msdasql.dll 02/14/2001  2.61.7131.0      16,384      Msdasqlr.dll 01/31/2001  2.61.7131.0      94,480      Msdatl3.dll 01/31/2001  2.61.7131.0      24,848      Msdatt.dll 03/09/2001                  271,360      Q277033_MDAC26_SP1_x86_fr.exe

Windows 2000
To resolve this problem, obtain the latest service pack for Windows 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

260910 How to Obtain the Latest Windows 2000 Service Pack

The P1 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      Time       Version      Size    File name

2/28/2001 12:24p    2.53.6131.0  303,376  Msdasql.dll 2/28/2001 12:24p    2.53.6131.0   16,384  Msdasqlr.dll 2/28/2001 12:24p    2.53.6131.0   78,096  Msdatl2.dll 2/28/2001 12:24p    2.53.6131.0   53,520  Msdatt.dll



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 MDAC 2.5 Service Pack 3. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.

Windows 2000
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 Windows 2000 Service Pack 3.



MORE INFORMATION
In OLE DB, SQL_BIGINT datatypes are DBTYPE_I8, which is an 8-byte signed integer. However, per the ODBC 2.x specifications, the default mapping for SQL_BIGINT in a 2.x driver is SQL_C_CHAR.

The ODBC provider (MSDASQL) has been modified so that SQL_BIGINT datatypes are now internally mapped to SQL_C_CHAR when using an ODBC 2.x driver, and then converted to DBTYPE_I8 when requested by OLE DB.

To determine if an ODBC driver is encountering this problem, examine an ODBC trace to see if a SQL_BIGINT datatype is being used. An example of the datatype attributes that will generate the error is shown below. inetinfo       924-1bc EXIT  SQLDescribeColW  with return code 0 (SQL_SUCCESS) HSTMT              01862458 UWORD                       1 WCHAR *            0x00000000 SWORD                       0 SWORD *            0x00000000 SWORD *            0x0277ECB4 (-5) SQLLEN *           0x0277ECC0 (19) SWORD *            0x0277ECD0 (0) SWORD *            0x0277ECAA (0) This shows the SQL datatype (6th argument) being reported as SQL_BIGINT (-5) with a column size (7th argument) of 19.

The Microsoft ODBC drivers (for instance, the Microsoft SQL Server ODBC Driver) should not generate this error because they are mostly ODBC 3.x compliant. The Microsoft ODBC Driver for Oracle is ODBC 2.x compliant, but does not support the SQL_BIGINT datatype. Third-party drivers that are ODBC 2.x compliant and also support SQL_BIGINT may experience this problem.

