Hi Tom,
I had exactly the same problem with DB2 on two workstations.
NT4, sp5, ActivePerl 5.6.1-628, DBI 1.20, DBD-DB2 0.75 and
W2K, sp2, ActivePerl 5.6.1-631, DBI 1.201, DBD-DB2 0.75
Collecting data from 3 databases (DB2 v2.1.2) OS2 Warp Server using DB2
client 5.2
to combine the data into a RS6000 AIX box with DB2 v6.1 installed.
I had no problems with the AIX box.
The error you'r describing occurd on all 3 DB2 v2.1.2 engines while
extracting data.
The number of rows didn't matter (Site A-1000, Site B- 16000, Site C-
24000) and the error
came up most of the time at the end of the script.
Even adding a extra hundred lines of code to the script (inserting data
into the AIX box) postponed
the error untill the script was finished.
What did solved my problem was loading all records into memory to
deallocate the statement handle.
$sqlstatement="SELECT * FROM areatype";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";
my $array_ref = $sth->fetchall_arrayref();
foreach my $row (@$array_ref) {
print "$row\n";
}
This of course if you have enough memory or not to many rows to fetch.
Hope it helps.
Paul.
Tom Price wrote:
> Hi,
>
> I'm a Perl Newbie and I'm having problems trying to use DBD with my
> Visual Foxpro free tables on Win2K. Here is the code:
>
> use DBI;
> #$dbh = DBI->connect('DBI:ODBC:ESLMI04','sa','price'); # SQL 6.5
> works!!!
> $dbh = DBI->connect('DBI:ODBC:EDS2000','','') or
> die $DBI::errstr; ; # Visual Foxpro free table,
> $sqlstatement="SELECT * FROM areatype";
> $sth = $dbh->prepare($sqlstatement);
> $sth->execute ||
> die "Could not execute SQL statement ... maybe invalid?";
>
> while (@row=$sth->fetchrow_array)
> { print "@row\n" };
>
> #$dbh->disconnect;
>
> It retrieves the data but I'm getting a message box "The instruction at
> 0x...(changes each execution) referenced memory at 0x0000004. Memory
> could not be written. Click on OK to terminate the program, click on
> CANCEL to debug the program."
>
> I created an identical table on M$ SQL Server 6.5 and it seems to work
> fine.
>
> Win2K Pro SP2, ODBC core version 3.520.7430.0, VFP driver 6.01.8629.01,
> DBD-ODBC 0.28, DBI 1.201
>
> What am I doing wrong?
>
> Any and all help is most appreciated!!!