FIX: You receive an "unexpected data length" error message when you run a query and you are using Host Integration Server OLE DB Provider for DB2 (903116)



The information in this article applies to:

  • Microsoft Host Integration Server 2004
  • Microsoft Host Integration Server 2000

SYMPTOMS

When you are using Microsoft Host Integration Server 2004 OLE DB Provider for DB2 or Host Integration Server 2000 OLE DB Provider for DB2, you may receive an error message that is similar to the following when you run a query:
OLE DB provider 'DB2OLEDB' returned an unexpected data length for the fixed-length column '[DB2OLEDB].TESTDATA'. The expected data length is 8, while the returned data length is 0. OLE DB error trace [Non-interface error: Unexpected data length returned for the column: ProviderName='DB2OLEDB', TableName='[DB2OLEDB]', ColumnName='TESTDATA', ExpectedLength='8', ReturnedLength='0'].

CAUSE

When a query returns a fixed-length character column, such as CHAR(4), the data provider expects to receive non null data for each byte of data. This problem occurs because a null character (hexadecimal 00) is embedded in the data.

RESOLUTION

Host Integration Server 2004

Hotfix information

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 Host Integration Server 2004 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.File information The English version of this hotfix has the file attributes (or later file attributes) 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
   ----------------------------------------------------------------------------------
   26-Jul-2005  16:11  6.0.1972.0  487,424  Db2oledb.dll
   26-Jul-2005  16:16               24,516  Db2oledb.h
   26-Jul-2005  16:11  6.0.1972.0   44,032  Ddmstr.dll
   26-Jul-2005  16:11  6.0.1972.0  114,688  Microsoft.hostintegration.msdb2client.dll
   26-Jul-2005  16:11  6.0.1972.0   71,680  Mseidb2c.dll
   26-Jul-2005  16:11  6.0.1972.0  435,200  Mseidb2d.dll
   26-Jul-2005  16:11  6.0.1972.0  693,760  Mseidrda.dll
Note Because of file dependencies, the most recent hotfix that contains these files may contain additional files.

Host Integration Server 2000

Hotfix information

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 Host Integration Server 2000 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.File information The English version of this hotfix has the file attributes (or later file attributes) 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
   -----------------------------------------------------
   25-Aug-2005  08:53  5.0.0.2077  311,568  Crtpkg.dll
   25-Aug-2005  08:53  5.0.0.2077   61,712  Crtpkg.exe
   25-Aug-2005  08:53  5.0.0.2077  696,592  Db2oledb.dll
   25-Aug-2005  08:53  5.0.0.2077   69,904  Mseidb2c.dll
   25-Aug-2005  08:53  5.0.0.2077  889,104  Mseidb2d.dll
   25-Aug-2005  08:53  5.0.0.2077  270,608  Mseidrda.dll
Note Because of file dependencies, the most recent hotfix that contains these files may contain additional files.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

The hotfix removes embedded null values in the data. Additionally, this hotfix appends spaces on the end of the string to make the string the same length as the fixed-length column.

Steps to reproduce the problem

  1. In IBM DB2, create a table that contains a fixed-length column and insert null characters in the column. To do this, run the following command:

    CREATE TABLE NULLSPACE (COL1 CHAR(4)) INSERT INTO NULLSPACE VALUES (x'00000000')

  2. In Microsoft SQL Server, define a linked server that uses the OLE DB Provider for DB2.
  3. In SQL Query Analyzer, run the following query.
    SELECT * FROM OPENQUERY(LINKSRVR, 'SELECT * FROM NULLSPACE')
    You receive the error message that is mentioned in the "Symptoms" section.
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Modification Type:MinorLast Reviewed:7/25/2006
Keywords:kbHotfixServer kbQFE kbfix kbbug kbpubtypekc KB903116 kbAudDeveloper