Microsoft KB Archive/907526

= FIX: Code DB_E_ERRORSOCCURRED and code DBSTATUS_E_BADSTATUS may be returned when you use the OLE DB Provider for DB2 that is included in Host Integration Server 2004 =

Article ID: 907526

Article Last Modified on 12/4/2007

-

APPLIES TO


 * Microsoft Host Integration Server 2004 Enterprise Edition
 * Microsoft Host Integration Server 2004 Standard Edition
 * Microsoft OLE DB Provider for DB2

-



SYMPTOMS
Consider the following scenario. You use the OLE DB Provider for DB2 that is included in Microsoft Host Integration Server 2004 to insert data into an IBM DB2 table. The IBM DB2 table contains an identity column. In this scenario, the DB_E_ERRORSOCCURRED error code may be returned to the calling application. Additionally, the DBSTATUS_E_BADSTATUS status code may be returned to the calling application.

This problem occurs when the status of the identity column is set to the DBSTATUS_S_IGNORE status code before the application tries to insert data into the table.

For example, the following SQL command creates an IBM DB2 table that contains an identity column. Therefore, this command creates an environment in which this problem may occur. CREATE TABLE IBMDB2.TEST_TABLE (

COLUMN1 INTEGER GENERATED ALWAYS AS IDENTITY ( START WITH 1, INCREMENT BY 1, NO CYCLE, MINVALUE 1, MAXVALUE 2147483647, NO CACHE ),

COLUMN2 INTEGER NOT NULL )

IN USERSPACE1



CAUSE
The OLE DB Provider for DB2 that is included in Host Integration Server 2004 does not support the DBSTATUS_S_IGNORE status code when one of the following methods is invoked:
 * IRowsetChange::Insert
 * IRowsetChange::SetData

Because the DBSTATUS_S_IGNORE status code is not supported, the OLE DB Provider for DB2 returns the DBSTATUS_E_BADSTATUS status code and the DB_E_ERRORSOCCURRED error code.



Hotfix information
A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:

http://go.microsoft.com/?linkid=6294451

Note If additional issues occur or any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. To create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

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 item in Control Panel.

Note Because of file dependencies, the most recent hotfix that contains these files may also contain additional files.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
After you apply the hotfix, the OLE DB Provider for DB2 correctly ignores columns that contain the DBSTATUS_S_IGNORE status code when the OLE DB Provider for DB2 invokes one of the following methods:
 * IRowsetChange::Insert
 * IRowsetChange::SetData

Steps to reproduce the problem
You can reproduce the problem by using the Rowset Viewer OLE DB sample application (RowsetViewer.exe). To do this, follow these steps:  Create an IBM DB2 table that contains an identity column.

Note To create this table, use the SQL command that is mentioned in the &quot;Symptoms&quot; section. Click Start, click Programs, click Microsoft Data Access SDK , and then click Rowset Viewer. The Microsoft OLE DB RowsetViewer window appears.

Note If Rowset Viewer is not installed on the system, download the Microsoft Data Access Components (MDAC) software development kit (SDK). For more information about the MDAC SDK, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?familyid=5067faf8-0db4-429a-b502-de4329c8c850

 In Windows Explorer, locate the Universal Data Link (UDL) file that contains the connection information for the IBM DB2 system.

Notes  Use the Host Integration Server 2004 Data Access Tool to create the UDL file. By default, UDL files are in the following location:

C:\Documents and Settings\ \My Documents\Host Integration Server Projects\Data Sources

</ul> </li> To connect to the IBM DB2 system, drag the UDL file from Windows Explorer to Rowset Viewer, and then click OK.</li>  Run the following SQL command: SELECT * FROM Table_Name Note The placeholder  represents the name of the table that you created in step 1. </li> In the Objects window in Rowset Viewer, right-click Rowset (SELECT * FROM ), click IRowsetChange, and then click InsertRow.

Note If the SELECT command that is mentioned in step 5 returns any data, you must click IRowset and then click ReleaseRows before you go to step 7.</li> Right-click the status value for the identity column to change the identity column status, and then click DBSTATUS_S_IGNORE.</li> Double-click the data value for a nonidentity column, and then type a value to insert into the table. For example, if the nonidentity column is defined as an INTEGER data type, type an integer.</li> Click InsertRow to insert the new data into the table. If the hotfix has not been applied, Rowset Viewer displays several error dialog boxes that show codes DBSTATUS_E_BADSTATUS and DB_E_ERRORSOCCURRED.</li></ol>

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

<div class="references_section">