Topic
  • 1 reply
  • Latest Post - ‏2009-01-22T11:02:43Z by SystemAdmin
SystemAdmin
SystemAdmin
262 Posts

Pinned topic Invalid string or buffer length and foreign characters

‏2009-01-22T08:36:35Z |
We have a PHP application serving web pages (LAMP stack: Ubuntu Hardy, PHP5) where we collect user information to store in db2 on an as/400 (or ISeries as I believe it is renamed to now). We too communicate with the db2 via unixODBC and ISeries Access for Linux. We're using odbc_exec to run the queries.

The problem is this, occationally the data we collect contains Norwegian characters. When trying to run an insert with æøå
this error message is given:

SQL error: unixODBCIBMiSeries Access ODBC DriverInvalid string or buffer length., SQL state S1090 in SQLExecDirect

We have tried using iconv to convert the sql insert statement to utf-8, iso-8859-1, iso-8859-15, even Windows-1252, ebcdic-dk-no and ebcdic-dk-no-a! None of which works. Utf-8 works flawlessly without the foreign characters.

The db2 already contains information about users which we use stored procedure calls to retreive just fine, even the ones with Norwegian letters. They seem to be in iso-8859-1.

The redbook "Linux Integration with IBM i5/OS" only mentions character encoding trouble for socket programming. We've also tried changing the locale to en_US.iso8859-1, and nb_NO iso8859-1 without it solving the problem.

Input, help and/or suggestions are very welcome.

Thanks
Updated on 2009-01-22T11:02:43Z at 2009-01-22T11:02:43Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    262 Posts

    Re: Invalid string or buffer length and foreign characters

    ‏2009-01-22T11:02:43Z  
    We've found a workaround for this, which is using odbc_prepare and odbc_execute instead of odbc_exec. I'd still like to know what's going on though:)