Dear fellow monks,

again I am fighting with Class::DBI and DB2.

I have a created a couple of classes similar to the Class::DBI::Loader::DB2, which is not really a great help for existing databases with no primary/foreign keys. Here this is done with unique indices, I set up the all/essential/primary columns manually. This works and is not my problem. There are 148 tables. Yes, it takes some time to set up this mass.

Now I try to find in each table all rows, which have an attribute set. As Class::DBI searches work with equality, I use

LRE::Mytable->retrieve_from_sql('locked<>0')
As I do not want to write 148 times nearly the same I did the following:

foreach my $table ( @AllTables) { my @locked; # locked entries my $cmd=sprintf "\@locked=LRE::%s->retrieve_from_sql('locked<>0')" +, ucfirst lc $table; printf "$cmd\n"; eval $cmd; print @_; foreach my $row(@locked) { printf "$table %6d %s\n", $row->sysid, $row->name ; } }
This works for a reduced array @AllTables, but if I scan all 148 tables I receive the error:

DBD::DB2::db prepare_cached failed: [IBM][CLI Driver][DB2/NT] SQL0954C + not enough memory (Application Heap) SQLSTATE=57011
(translated and shortened message)

How do I release the memory? I tried a dbi_commit() within the loop, but it did not help. This is independant of the table itself (and so the SQL statement), but the mass of statements. I am not sure, wether this is a DB2 driver or Class::DBI problem, as I never had problems with the DB2 interface so far and doing selects the hard way is working.

Thank you for any help.

And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)


In reply to DBD::DB2 Application Heap full by Brutha

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.