I appreciate any help. In my Perl script I have a code part that fetches a data from database InterBase, everything works fine except in case when fetched data has size of over 1MB! Script(s) work just fine if the "content" in MEMO or BLOB fields of the database has smaller size than 1MBytes; if size of the file (data) is over 1MB then "ERROR: Blob exceeds maximum length" is generated in the "error.log" of the Apache Server (and of course data is not fetched):

# . . . . . - rest of the code use DBI; # . . . . . - rest of the code # name & location of the database $dbpath = 'C:\Database\database_01.fdb'; $dsn = "DBI:InterBase:database=$dbpath;host=123.456.78.9;ib_dialec +t=3"; # connesting to DB $dbh = DBI->connect($dsn, '', '', {AutoCommit => 0}) or die "$DBI: +:errstr"; # setting the size of the buffer (1KB) $dbh -> {LongReadLen} = 1024; # NO matter if Truncation is ON or OFF? Tried both cases! #$dbh -> {LongTruncOk} = 0; $dbh -> {LongTruncOk} = 1; # here, DATA is MEMO field in the database! $sql = "SELECT FIRST 1 DATA FROM CONFIGURATION ORDER BY CREATEDDAT +E DESC"; $sth = $dbh->prepare($sql) or die "Preparing: ", $dbh->errstr; $sth->execute or die "Executing: ", $sth->errstr; # opening FILE HANDLER for writing the content of the MEMO/BLO +B field open (F, ">./database1.txt"); # fetching the content while (@row = $sth->fetchrow_array()) { foreach (@row) { # saving into the file "database1.txt"! print F "$_"; } } close F; $sth->finish; $dbh->commit or warn $dbh->errstr; $dbh->disconnect or warn $dbh->errstr; # . . . . . - rest of the code

I have tried several workarounds (in the current code I've increased the size of the buffer, LongReadLen - EVEN to 10MB; also tried with chunks & blob_read method - to get small pieces of data & to compose/concatenate them again at the end BUT got nothing, even with data that had size of only 10KB!), everytime it was unsuccessfully! Maybe I should replace the DBD-InterBase with some other Perl module?
Installed Environment: Perl version 5.6.1, Firebird 1.5.0 (database: InterBase) and I have two similar scripts (Win32 & Unix), both work OK when fetched data had smaller size than 1MB, installed Perl modules: DBI 1.37, DBD-InterBase 0.40.

*NOTICE: I read this:
"The DBI currently defines no way to insert or update LONG/LOB values piece-wise - piece by piece. That means you're limited to handling values that will fit into your available memory."
as well as:
"Read/Write BLOB fields block by block not (yet) supported. The maximum size of a BLOB read/write is hardcoded to about 1MB."
- Does that mean that I can't get data using DBI and DBD:InterBase with size larger than 1MB?

Please help me with any ideas, hints or solutions!


In reply to InterBase MEMO/BLOB fields, data with size > 1MB by pet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.