rdecanio has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to querey a database using dbi. One of the columns is approx. 500 chars. I am retrieving each row into an array like so:
############################# $db_array_ref = $WinSelSth->fetchall_arrayref() ; for my $row (@$db_array_ref) { my ($req, $lob, $cycle, $status, $comments) = @$row ; #############################
I am getting a "DBD::ODBC::st fetchall_arrayref failed: [Microsoft][:ODBC Microsoft Access Driver]String data, right truncated on column number 5" The fifth column being the "large column". I am assuming a perl array doesn't like elements with that much data in it. I can't reduce the amount of data, does anyone have any ideas?

2003-04-24 edit ybiC: <code> tags, HTML encode square brackets

Replies are listed 'Best First'.
Re: Retrieving data w/ dbi with a large column
by perlplexer (Hermit) on Apr 24, 2003 at 02:19 UTC
    Make sure your "LongReadLen" and "LongTruncOk" attributes are set properly (click here and then search for "LongReadLen").

    --perlplexer
Re: Retrieving data w/ dbi with a large column
by Juerd (Abbot) on Apr 24, 2003 at 12:51 UTC

    The fifth column being the "large column". I am assuming a perl array doesn't like elements with that much data in it. I can't reduce the amount of data, does anyone have any ideas?

    Perl doesn't care. The ODBC driver is complaining, not Perl. 500 chars is not at all large or anywhere near large, by the way.

    The very first hit Google gives me when I search for String data, right truncated on column number is:
    http://www.easysoft.com/products/9999/faq_answer.phtml?ID=716&product=2002. It contains a detailed explanation of the problem and mentions a very easy work around for Perl users

    Next time, STFW before asking.

    Juerd
    - http://juerd.nl/
    - spamcollector_perlmonks@juerd.nl (do not use).
    

Re: Retrieving data w/ dbi with a large column
by Abigail-II (Bishop) on Apr 24, 2003 at 12:50 UTC
    Perl has no limitations when it comes to data size. The only limitations that occur are the ones imposed by your OS.

    The error you get is not a Perl error, it's caused by your DBD driver. It may very well be that the driver is just relaying an error from the ODBC libraries, or whatever database is connected to.

    Abigail

Re: Retrieving data w/ dbi with a large column
by perltastic (Initiate) on Apr 25, 2003 at 22:50 UTC
    Its unlikely that perl croaks on 500 characters of data.

    Probably what you need to tweak, is the DBI. You need special settings in DBI if any column is a long, BLOB or similar ( check associated DBD documentation )

    http://search.cpan.org/author/TIMB/DBI-1.35/DBI.pm#Handling_BLOB_LONG_Memo_Fields