Knowledge Base

FIX: SQLPutData Truncates LONG RAW Data Using Oracle ODBC Driver

Article ID: 184806

Article Last Modified on 2/14/2005


APPLIES TO


This article was previously published under Q184806

SYMPTOMS

Using the Microsoft ODBC Driver for Oracle (build 2.73.728303) that ships with MDAC 1.5c causes a SQL_SUCCESS_WITH_INFO message and a "Data Truncated" error when trying to store LONG RAW data with SQLPutData and using SQLBindParameter with the ColumnSize (6th Parameter) set to 0 or less than the actual length of the data. This occurs even though SQLGetInfo for SQL_NEED_LONG_DATA_LEN returns a "No". Also, no data is written to the LONG RAW field.

The problem occurs if you bind the parameter as a SQL_C_BINARY and SQL_BINARY like this:
g_rc = SQLBindParameter(g_hstmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_BINARY, 0, 0, NULL, 0, &cbVal1);
				

RESOLUTION

Make the Columnsize parameter of the SQLBindParameter equal to or greater than the actual value of the data length passed in SQLPutData. Upgrade to the Microsoft Oracle ODBC Driver available in Visual Studio 6.0 or Microsoft Data Access Components version 2.0 or later. You can download the MDAC Components from the following Web address:

STATUS

This bug has been fixed in version 2.573.2927 of the Microsoft Oracle ODBC Driver.

Additional query words: msoracle

Keywords: kbbug kbfix kbodbc200fix kboracle kbdriver kbmdacnosweep KB184806