Topic
  • 2 replies
  • Latest Post - ‏2009-08-05T16:20:30Z by SystemAdmin
SystemAdmin
SystemAdmin
262 Posts

Pinned topic CWB0111 - A buffer passed to a system call is too small to hold return data

‏2009-08-03T11:43:59Z |
Hello,

I'm trying to simply do a SELECT from System i Access
ODBC Driver.
It works perfectly in PHP but not in perl !

What I do :
> > use DBI;
> > $dbh = DBI->connect('dbi:ODBC:' . $dsnname, $dbuser, $dbpwd) or...
> > $sth = $dbh->prepare($sql) or die...
> > do {
> > my @row;
> > my $line=1;
> > # fetch each row in array
> > while (@row = $sth->fetchrow_array())
> > {
> > print ($line + 1);
> > print ". ";
> > # print each field in a row
> > for ($i=0;$i<$#row;$i++)
> > {
> > print $row$i
> > };
> > print "\n";
> > $line++;
> > }
> > # see if there's more records to show
> > } while ($sth->{odbc_more_results});
But even if my script is working, most of the time (not always but 80%
of time ???) I get this error :

DBD::ODBC::st fetchrow_array failed: unixODBCIBM[System i Access
ODBC Driver]Column 1: CWB0111 - A buffer passed to a system call is too
small to hold return data (SQL-22018) state was 22018 now 01004

unixODBCIBMSystem i Access ODBC DriverString data right
truncation. (SQL-01004) at ./odbcdemo-perl.pl line n.

I'm not an ODBC expert, not a DBI expert, therefore I'm maybe forgetting
something important to be done, but I don't find anything on the web
that helped me...

Last idea, could it be due to UTF8, which would create difference in
string sizes ?

I found a similar bug in PHP :
http://www-01.ibm.com/support/docview.wss?uid=nas1ac5658703ae5a78b862575440052cbda

And a thread about my problem but without solution :
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=185874&tstart=45

But I don't understand DBI enough to understand what I should do ?

Thanks a lot for any help !

Denis
Updated on 2009-08-05T16:20:30Z at 2009-08-05T16:20:30Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    262 Posts

    Re: CWB0111 - A buffer passed to a system call is too small to hold return data

    ‏2009-08-03T11:45:29Z  
    BTW it seems I'm not the first one to have this problem, but what is the solution ?
    • http://www.ibm.com/developerworks/forums/thread.jspa?threadID=185874&tstart=45
  • SystemAdmin
    SystemAdmin
    262 Posts

    [SOLVED - BUG in IBM driver] Re: CWB0111 - A buffer ... is to small

    ‏2009-08-05T16:20:30Z  
    BTW it seems I'm not the first one to have this problem, but what is the solution ?
    • http://www.ibm.com/developerworks/forums/thread.jspa?threadID=185874&tstart=45
    Hello everyone,

    The problem is half-solved ! It's a bug in the IBM driver.

    It is exactly the same cause (locale) as in the following thread :
    http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14051384

    I think the problem is that the AS 400 (iSeries) replies with 30 characters and converted to UTF8 it makes 31 bytes. This is a bug...

    If you want more details ask me, but in a word you need to set some of your Linux/Unix environnement variables to anything NOT utf8 !