APAR status
Closed as program error.
Error description
Doing a SQLBindParameter of a LVARCHAR column using anything other than SQL_NTS may cause incorrect data been send to the server when the InsertCursor feature is enable in the ODBC driver. --------- --------- Still need to find out why, but we are adding some extra zeros to the TUPLE package we send to the server. This is only a problem if we use WCHAR + LVARCHAR and only if we have InsertCursors enabled. /* drop table "informix".t1; create table "informix".t1 (c1 lvarchar(2000),c2 char(36) not null ); C->S (66) Time: 2019-10-17 15:33:15.16500 SQ_ID 0 SQ_RET_TYPE Direction: 0 (FOR PUT) # of types: 2 Type.....: VARCHAR; NULLABLE Variable Length: 8 Type.....: CHAR; NULLABLE Variable Length: 20 SQ_PUT Size of data row: 33 # rows..........: 1 ================================================================ ================ HEX DUMP: 0: 00 00 00 00 04 74 65 73 74 00 00 00 00 74 65 73 .....test....tes 0x10: 74 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 t2 0x20: 20 00 . ================================================================ ================ SQ_EOT the 4 00s after "test" shouldn't be there. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef WIN32 #include <io.h> #include <windows.h> #include <conio.h> #include <fcntl.h> #include <sys/stat.h> #endif #include "infxcli.h" int main (long argc, char* argv[]) { SQLHDBC hdbc; SQLHENV henv; SQLHSTMT hstmt; SQLRETURN rc = 0; SQLPOINTER cbNULL = SQL_NULL_DATA; SQLCHAR SqlState[200] = "", ErrorMsg[200] = ""; SQLINTEGER IsamError = 0; SDWORD NativeError = 0L; SWORD ErrorMsgp = 0; SQLSMALLINT recnum = 1; SQLWCHAR Values1[100]=L"test"; SQLWCHAR Values2[100]=L"test2"; SQLLEN Lens1 = 8; // SQL_NTS SQLLEN Lens2 = 10; // SQL_NTS SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, 0); // Connect SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); SQLDriverConnectW(hdbc, 0, L"DSN=ids1210_32;uid=informix;pwd=ximrofni", SQL_NTS, NULL, 0, 0,SQL_DRIVER_NOPROMPT); SQLSetConnectAttr(hdbc, SQL_INFX_ATTR_ENABLE_INSERT_CURSORS, (SQLUINTEGER*) 1, 0); // Prepare the statment and bind its one parameter SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); SQLPrepare(hstmt, (char*) "insert into informix.t1 values (?,?)", SQL_NTS); rc=SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_CHAR, 5, 0, Values1, 10, &Lens1); rc=SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_CHAR, 6, 0, Values2, 12, &Lens2); SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER*) 1, SQL_IS_INTEGER); rc=SQLExecute(hstmt); if (rc != SQL_SUCCESS) { SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, recnum, SqlState, &NativeError, ErrorMsg, 199, &ErrorMsgp); fprintf(stdout, "SqlState = %s\n Native Error = %d\n Error Message = %s\n", SqlState, NativeError, ErrorMsg); fprintf (stdout, "Connection failed!\n"); return (1); } fprintf (stdout, "DONE\n"); // Clean up SQLFreeHandle(SQL_HANDLE_STMT, hstmt); SQLDisconnect(hdbc); SQLFreeHandle(SQL_HANDLE_DBC, hdbc); SQLFreeHandle(SQL_HANDLE_ENV, henv); return (rc); } // ----------------
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: * * Users of Informix Client SDK 4.10.xC11 or earlier versions. * **************************************************************** * PROBLEM DESCRIPTION: * * LVARCHAR DATA IS NOT CORRECTLY SENT TO THE SERVER WHEN USING * * INSERT CURSORS (ODBC) * **************************************************************** * RECOMMENDATION: * ****************************************************************
Problem conclusion
Fixed in Informix Client SDK 4.10.xC14 and 4.50.FC3.
Temporary fix
Comments
APAR Information
APAR number
IT30719
Reported component name
IBM CSDK
Reported component ID
5724C2381
Reported release
410
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2019-10-28
Closed date
2020-03-03
Last modified date
2020-03-03
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
IBM CSDK
Fixed component ID
5724C2381
Applicable component levels
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSCVRDE","label":"Informix Client Software Development Kit"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"4.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Document Information
Modified date:
03 March 2020