Things to check though not neccessarily in this order...

1. Check out DBI trace output to see if there is anything interesting there.
2. Is it data related? What if you delete the first 3000 lines and try the
remaining 6968 does it still fail after 2479?
3. Is there some bizzare DB thing going on? What if after every 500 queries
you disconnect/reconnect and re-prepare the statement?

Other than that I can't see anything inherently wrong with the code.

HTH

Ken.

-----Original Message-----
From: Sumitro Chowdhury [mailto:[EMAIL PROTECTED]]
Sent: 16 July 2002 01:27
To: [EMAIL PROTECTED]
Subject: core dumps after exactly 2479 query on the same table


Hi,
Please direct me to the correct list if the problem is too elementary ...

I read data from a 9968 lines text file, one line at a time and use the data
to query a DB2 table (select count(*) from table_name where
column_name=data ).

The perl script core dumps after exactly 2479 queries every time
(segmentation fault).
The data is good and using Korn Shell script, I can query all the 9968 lines
OK.

The perl script loop is like this:
.......
my $exist_prod_raw_clipaudio = $dbh->prepare_cached('SELECT count(*) as
count  from product.prod_raw_clipaudio where pm_upc = ?')
........
open (UPCFILE,$filename) || die "Could not open $filename.";
open (SRCFILE,">$scriptname") || die "Could not open $scriptname.";

# Set auto flush for SRCFILE
my $oldfh = select (SRCFILE);
$| = 1;
select ($oldfh);

my $UPC;
my $rows;
my @row;
while (<UPCFILE>) {
    $UPC=$_;
    print "Got UPC as $UPC";
    chop $UPC;
    $exist_prod_raw_clipaudio->execute($UPC) || die "Couldn't execute
statement : " . $exist_prod_raw_clipaudio->errstr;
    $rows=0;
    while ( @row = $exist_prod_raw_clipaudio->fetchrow_array ) {
        print "Printing row now ...\n";
        print "\@row exists: " if (@row);
        print "@row : ";
#       print ".";
        $rows = $row[0];
    }
    print "\nGot $rows rows for UPC $UPC \n";
    print SRCFILE "rm $UPC*\n" if ($rows > 0 );
#   $exist_prod_raw_clipaudio->finish;
#   $update_clip_location_detail->finish;
}
$dbh->disconnect;

-------- End of script -----
The Output is like this :
.........
Got UPC as 07464375452
Printing row now ...
@row exists: 14 :
Got 14 rows for UPC 07464375452
Got UPC as 07464375512
Printing row now ...
@row exists: 0 :
Got 0 rows for UPC 07464375512
Got UPC as 07464375932
Printing row now ...
Segmentation fault(coredump)


How should I diagonise this problem ?


Sumitro Chowdhury

Reply via email to