Solved TD-19073: DB2 9.7 datetime bind variable issue with TD 4.2

Post found bugs and possible workarounds.

TD-19073: DB2 9.7 datetime bind variable issue with TD 4.2

Post by Panteli » 12 Aug 2010, 13:24


We have started using DB2 9.7 recently with our applictions which are built on CDT 4.2. But we have encountered an issue with SQL when using Datetime bind variables against DB2 TIMESTAMP columns. The error appears as:
SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007

The issue only exists when using the DB2 9.7 Client with a DB2 9.7 server database. It works fine when using the older DB2 9.1 Client with DB2 9.7 server. Also the DB2 9.7 Client works fine when using older DB2 servers (9.1, 8.1).

The issue appears restricted to the Datetime datatype, when using a string variable on a TIMESTAMP column it works fine so does using a literal representation of the timestamp.

I ran some traces and it appears the issue is within the ODBC SQLBindParameter fn, the last parameter 'pcbValue' (pointer to a buffer containing the parameters length) contains the value 16 instaed of 26 (timestamp length) when using a Datetime bind variable which leads to the error reported above. The db2_cli_trace.97.txt trace best shows this displaying the trucated datetime value near the SQLExecute call.

I've supplied the traces from my test app which executes two basic select statements:
select int1, cdt1 into :nBind1, :dtDTStamp from test01 where int1=2
select vch10 into :strBind2 from test01 where cdt1 = :dtDTStamp

set1 - DB2 9.1 client with DB2 9.7 server (this combination executes correctly)

set2 - DB2 9.7 client with DB2 9.7 server ( ERRORS here)

Also supplying the test app used for the above traces and select statements.

Any help with this issue would be greatly appreciated.
You do not have the required permissions to view the files attached to this post.

Jean-Marc Gemperle

Re: TD-19073: DB2 9.7 datetime bind variable issue with TD 4.2

Post by Jean-Marc Gemperle » 27 Feb 2013, 10:05

This got recognized as a TD issue
TD-19073 and currently internally fixed. for 6.0 and 6.1 base version.

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 3 guests