Article ID: 924599 - Last Review: December 4, 2007 - Revision: 1.3 FIX: Error message when you run an SQL statement by using OLE DB Provider for DB2: "SQLSTATE 22007, SQLCODE -181"
On This PageSYMPTOMS Consider the following scenario. You run an SQL statement by using Microsoft OLE DB Provider for DB2. The SQL statement passes a Microsoft SQL Server datetime parameter to an IBM DB2 database column. The IBM DB2 database column uses the IBM DB2 DATE data type. In this scenario, you may receive the following error message: SQLSTATE: 22007, SQLCODE: -181 CAUSE At runtime, OLE DB Provider for DB2 does not know the correct IBM DB2 data type for the IBM DB2 database column to which the SQL Server datetime parameter is passed. Therefore, OLE DB Provider for DB2 includes the date information and the time information in the value that OLE DB Provider for DB2 passes to the IBM DB2 database. The time information is not valid for the IBM DB2 DATE data type. Therefore, you receive the error message that is mentioned in the "Symptoms" section. RESOLUTIONMicrosoft Host Integration Server 2004A supported hotfix is 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 software update that contains this hotfix.If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix. Note If additional issues occur or if 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. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: http://support.microsoft.com/contactus/?ws=support
(http://support.microsoft.com/contactus/?ws=support)
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.File informationThe 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.Collapse this table
Microsoft OLE DB Provider for DB2 version 1.0A supported hotfix is 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 software update that contains this hotfix.If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix. Note If additional issues occur or if 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. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: http://support.microsoft.com/contactus/?ws=support
(http://support.microsoft.com/contactus/?ws=support)
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.File informationThe 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.32-bit (x86) versionCollapse this table
64-bit (x64) versionCollapse this table
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. MORE INFORMATIONThis hotfix adds support for a new connection string property. By using the new connection string property, you can pass a SQL Server datetime parameter to an IBM DB2 database as the IBM DB2 DATE data type. OLE DB Provider for DB2 deletes the time information in the value of the SQL Server datetime parameter. Therefore, OLE DB Provider for DB2 passes only the date information to the IBM DB2 database. The new connection string property has the following definition: DateTime As Date=Value In this connection string property, you can define Value as TRUE or as FALSE. If you add the DateTime As Date=TRUE statement to the connection string, OLE DB Provider for DB2 converts the SQL Server datetime parameter to the IBM DB2 DATE data type. Then, OLE DB Provider for DB2 passes the value to the IBM DB2 database.If you add the DateTime As Date=FALSE statement to the connection string, OLE DB Provider for DB2 passes the SQL Server datetime parameter to the IBM DB2 database as you specify in the SQL statement. In this case, OLE DB Provider for DB2 passes the date information and the time information to the IBM DB2 database. Note This behavior is the default behavior if you do not add the DateTime As Date property to the connection string. The following connection string example shows how to use the DateTime As Date property. SQLSTATE: 22007, SQLCODE: -180 If you must query an IBM DB2 table that uses the IBM DB2 DATE data type and the IBM DB2 TIMESTAMP data type, you may have to use multiple connection strings that are configured to use the correct properties. Then, you can successfully query the various IBM DB2 data types. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 824684
(http://support.microsoft.com/kb/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, about the performance or reliability of these products. | Article Translations
|
Back to the top
