Skip to main content

CWB0111 when Using iSeries Access for Linux to SELECT Variant Characters


 Technote

PHP applications that use the iSeries Access for Linux ODBC driver to SELECT CHAR data containing characters outside the invariant character set (for example: ""), and using a UTF-8 locale, may receive extra garbage data at the end of the character string. This is caused by PHP passing an insufficient target length on the call to SQLBindCol(). PHP is setting the incorrect buffer length by using SQLColAttributes to return the SQL_COLUMN_DISPLAY_SIZE.

PHP Bug 47133: php-odbc SQLBindCol() not used correctly has been submitted.

IBM Support has seen this behavior in PHP versions 5.1 and 5.2.6-2. This problem also exists in PHP for Windows. iSeries Access for Linux versions 5.4 and 6.1 is affected.

The ODBC driver correctly returns error message CWB0111 - A buffer passed to a system call is too small to hold return data .

The ODBC driver has implemented a circumvention to not return the extra garbage data at the end of the CHAR string when using a connection string keyword option. PHP applications could then ignore the CWB0111 error message.

Developers of PHP applications that wish to use this work-around and prevent the extra garbage data must pass in the following connection string keyword:
DEBUG = 65536
The above line in bold can be added to an ODBC DSN in an odbc.ini file.

Versions of the iSeries Access for Linux ODBC driver that contain the circumvention are available here:

ftp://ftp.software.ibm.com/as400/products/clientaccess/linux/v6r1m0/files/odbc/se35669/
ftp://ftp.software.ibm.com/as400/products/clientaccess/linux/v5r4m0/files/odbc/se35669/

Additional options:

o PHP does not calculate all buffer lengths using SQL_COLUMN_DISPLAY SIZE, so PHP developers could use other SQL column types such as:
SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY or SQL_LONGVARCHAR. No binding occurs with those data types and SQLGetData() is used to retrieve the value.

o For long data, it may be necessary to call PHP ODBC API odbc_longread() (//us3.php.net/odbc_longreadlen ) because that is the length to be used for the buffer. If less data is available, PHP shrinks the buffer; however, if more data is available, truncation will occur.

APAR SE33393 describes this defect as encountered using PHP for Windows.






System i Support


    IBM disclaims all warranties, whether express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. By furnishing this document, IBM grants no licenses to any related patents or copyrights. Copyright © 1996,1997,1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 IBM Corporation. Any trademarks and product or brand names referenced in this document are the property of their respective owners. Consult the Terms of use link for trademark information.

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

i family


Software version:
V5R3M0, V5R3M5, V5R4M0, V5R4M5, V6R1M0


Operating system(s):
OS/400


Reference #:
512920226


Modified date:
2013-03-06

Translate my page

Content navigation