Update:
I tried this on a different machice, still connecting remotely to the DB2 server, and it worked ok. So it must be some sort of configuration issue :(

End update

I am working on a program that is querying a remote DB2 server for some data. In a test run, i am getting an error preparing a query. The query is nothing complicated, its like:

SELECT LIST_NBR, PARCEL_NBR FROM list WHERE PARCEL_NBR = '0540040'

I'm running basically the same query over and over, with a different value for PARCEL_NBR. (yes i'll add bind_params when things begin working). Anyway, regardless of where i start in my list, i get an error on the 1327th iteration. Even if i keep asking for the same values, it dies on the 1327 iteration.

Here is a VERY stripped down version of what im doing, which still gives the error:

use strict; use warnings; use DBI; use DBD::DB2; $ENV{'DB2INSTANCE'} = [...]; { my $db_handle = DBI->connect('DBI:DB2:FLEX', [user], [pass], { 'RaiseError' => 1, 'PrintError' => 1, }, ) or die "couldnt connect to FLEX db $?\n"; my $taxkey = '0540040'; for my $i (0 .. 1400) { print "COUNT: $i\n"; find_listings_for_parcel($db_handle, $taxkey); } $db_handle->disconnect(); } sub find_listings_for_parcel { my ($db_handle, $taxkey) = @_; my $query = "SELECT LIST_NBR, PARCEL_NBR FROM list " . " WHERE PARCEL_NBR = " . $db_handle->quote($taxkey); my $query_handle; eval { $query_handle = $db_handle->prepare($query); }; if ( $@ ) { print "QUERY: $query\n"; exit; } eval { $query_handle->execute(); }; if ( $@ ) { print "QUERY: $query\n"; exit; } $query_handle->finish(); }
The error I'm getting is:
... COUNT: 1326 DBD::DB2::db prepare failed: [IBM][CLI Driver][DB2/SUN64] SQL0805N Pa +ckage "NULLID.SYSLH203 0X5359534C564C3031" was not found. SQLSTATE=5 +1002 QUERY: SELECT LIST_NBR, PARCEL_NBR FROM list WHERE PARCEL_NBR = '0540 +040'
This must be some sort of memory leak or resource clash, because it is doing the same thing over and over, and eventually dies after many iterations. I have tried with other PARCEL_NBR values, with the same result.

Oh, LIST_NBR is 'integer not null'
and PARCEL_NBR is 'varchar(50)'
Any ideas?
Thanks


In reply to DBD::DB2 prepare() error by shemp

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.