Products Resources Support About Us

PDO DB2 and VARCHAR more than 255 characters


We want to use PHP to access DB2 tables with VARCHAR columns longer than 255 characters.

When a SELECT query is executed, the value of a VARCHAR column of more than 255 characters is not returned …

By enabling a trace in the DSNAOINI configuration (APPLTRACE = 1 and APPLTRACEFILENAME = path), we find that the SQLGetData statement returns an SQL_ERROR when accessing this column.

Is this a limitation of the ODBC driver? Of PDO?
Is there a way to circumvent this limitation?

Thank you in advance for your help.




I have got the same problem and it is a real showstopper for me.
I know this is not a limitation of ODBC or PDO, because the IBM ported tools did work with long varchar’s.
Wonder if this is fixed or will be fixed in the near future.


Hi Denis and Leo,

Thanks for reporting.
The internal issue was opened for this case.