Perl DBI ODBC
am 12.10.2005 17:12:20 von Bernd Sandmann
Hello,
the following Script is crashing under Windows with the Error:
---------------------------
perl.exe - Fehler in Anwendung
---------------------------
Die Anweisung in "0x1134030c" verweist auf Speicher in "0x1134030c". Der
Vorgang "read" konnte nicht auf dem Speicher durchgeführt werden.
Klicken Sie auf "OK", um das Programm zu beenden.
use DBI;
$SQL = "select * from PeriodenumsaetzeSachkonten";
my $DSN = "Sage KHK 3.3.3";
my $dbh = DBI->connect("dbi:ODBC:$DSN", '','')
or die "$DBI::errstr\n";
$sth = $dbh->prepare($SQL);
$sth->execute() or die "$DBI::errstr\n";
$sth->dump_results;
$dbh->disconnect;
Can someone help me?
Re: Perl DBI ODBC
am 12.10.2005 18:17:40 von John Bokma
Bernd Sandmann wrote:
> Hello,
>
> the following Script is crashing under Windows with the Error:
>
> ---------------------------
> perl.exe - Fehler in Anwendung
> ---------------------------
> Die Anweisung in "0x1134030c" verweist auf Speicher in "0x1134030c".
> Der Vorgang "read" konnte nicht auf dem Speicher durchgeführt werden.
> Klicken Sie auf "OK", um das Programm zu beenden.
Which version of DBI, ODBC, Perl (ActiveState? Other?)
> use DBI;
A lot of people will complain if you don't use strict and use warnings;
> $SQL = "select * from PeriodenumsaetzeSachkonten";
>
> my $DSN = "Sage KHK 3.3.3";
> my $dbh = DBI->connect("dbi:ODBC:$DSN", '','')
> or die "$DBI::errstr\n";
>
> $sth = $dbh->prepare($SQL);
> $sth->execute() or die "$DBI::errstr\n";
>
> $sth->dump_results;
>
> $dbh->disconnect;
>
> Can someone help me?
Try to comment out each line, then turn them on one by one, to find the
crash point.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)
Re: Perl DBI ODBC
am 13.10.2005 09:16:04 von Bernd Sandmann
John Bokma schrieb:
> Bernd Sandmann wrote:
>
>
>>Hello,
>>
>>the following Script is crashing under Windows with the Error:
>>
>>---------------------------
>>perl.exe - Fehler in Anwendung
>>---------------------------
>>Die Anweisung in "0x1134030c" verweist auf Speicher in "0x1134030c".
>>Der Vorgang "read" konnte nicht auf dem Speicher durchgeführt werden.
>>Klicken Sie auf "OK", um das Programm zu beenden.
>
>
> Which version of DBI, ODBC, Perl (ActiveState? Other?)
The Versions are:
Perl ActiveState Version 5.8.7 Build 813
DBI 1.48
DBD-ODBC 1.13
i think these are the newest versions. But i have also tested it with
different versions of Perl and DBI,ODBC. The error is always the same.
>
>
>>use DBI;
>
>
> A lot of people will complain if you don't use strict and use warnings;
You are right, i haven´t used it because of my decleration errors :-)
The finally script is much longer, so i use this little part only for
the testing of the ODBC-Access.
>
>
>>$SQL = "select * from PeriodenumsaetzeSachkonten";
>>
>>my $DSN = "Sage KHK 3.3.3";
>>my $dbh = DBI->connect("dbi:ODBC:$DSN", '','')
>> or die "$DBI::errstr\n";
>>
>>$sth = $dbh->prepare($SQL);
>>$sth->execute() or die "$DBI::errstr\n";
>>
>>$sth->dump_results;
>>
>>$dbh->disconnect;
>>
>>Can someone help me?
>
>
> Try to comment out each line, then turn them on one by one, to find the
> crash point.
>
The error comes after the execution of the prepare Statement.
( $sth = $dbh->prepare($SQL);)
A trace show the folloing:
perl -w test.pl
DBI 1.48-ithread default trace level set to 0x0/1 (pid 1664)
-> DBI->connect(dbi:ODBC:Sage KHK 3.3.3, , ****)
-> DBI->install_driver(ODBC) for MSWin32 perl=5.008007 pid=1664
ruid=0 euid=
0
install_driver: DBD::ODBC version 1.13 loaded from
C:/Programme/Perl/site
/lib/DBD/ODBC.pm
<- install_driver= DBI::dr=HASH(0x1b6236c)
<- connect('Sage KHK 3.3.3' '' ...)= DBI::db=HASH(0x1bdf1c4) at
DBI.pm line
598
<- STORE('PrintError' 1)= 1 at DBI.pm line 645
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 645
<- STORE('Username' '')= 1 at DBI.pm line 648
<> FETCH('Username')= '' ('Username' from cache) at DBI.pm line 648
<- connect= DBI::db=HASH(0x1bdf1c4)
<- STORE('dbi_connect_closure' CODE(0x1bdf104))= 1 at DBI.pm line 668
<- prepare('select Kontonummer from PeriodenumsaetzeSachkonten')=
DBI::st=HA
SH(0x1be8730) at test.pl line 21
<- DESTROY(DBI::st=HASH(1be8730))= undef
<- DESTROY(DBI::db=HASH(1bdf1c4))= undef
<- disconnect_all= '' at DBI.pm line 677
! <- DESTROY(DBI::dr=HASH(1b6236c))= undef during global destruction
The Script crashes always when it is ended. As soon as the
Destroy statements where executed.
Regards Bernd.
Re: Perl DBI ODBC
am 13.10.2005 09:18:16 von Bernd Sandmann
John Bokma schrieb:
> Bernd Sandmann wrote:
>
>
>>Hello,
>>
>>the following Script is crashing under Windows with the Error:
>>
>>---------------------------
>>perl.exe - Fehler in Anwendung
>>---------------------------
>>Die Anweisung in "0x1134030c" verweist auf Speicher in "0x1134030c".
>>Der Vorgang "read" konnte nicht auf dem Speicher durchgeführt werden.
>>Klicken Sie auf "OK", um das Programm zu beenden.
>
>
> Which version of DBI, ODBC, Perl (ActiveState? Other?)
The Versions are:
Perl ActiveState Version 5.8.7 Build 813
DBI 1.48
DBD-ODBC 1.13
i think these are the newest versions. But i have also tested it with
different versions of Perl and DBI,ODBC. The error is always the same.
>
>
>>use DBI;
>
>
> A lot of people will complain if you don't use strict and use warnings;
You are right, i haven´t used it because of my decleration errors :-)
The finally script is much longer, so i use this little part only for
the testing of the ODBC-Access.
>
>
>>$SQL = "select * from PeriodenumsaetzeSachkonten";
>>
>>my $DSN = "Sage KHK 3.3.3";
>>my $dbh = DBI->connect("dbi:ODBC:$DSN", '','')
>> or die "$DBI::errstr\n";
>>
>>$sth = $dbh->prepare($SQL);
>>$sth->execute() or die "$DBI::errstr\n";
>>
>>$sth->dump_results;
>>
>>$dbh->disconnect;
>>
>>Can someone help me?
>
>
> Try to comment out each line, then turn them on one by one, to find the
> crash point.
>
The error comes after the execution of the prepare Statement.
( $sth = $dbh->prepare($SQL);)
A trace show the folloing:
perl -w test.pl
DBI 1.48-ithread default trace level set to 0x0/1 (pid 1664)
-> DBI->connect(dbi:ODBC:Sage KHK 3.3.3, , ****)
-> DBI->install_driver(ODBC) for MSWin32 perl=5.008007 pid=1664
ruid=0 euid=
0
install_driver: DBD::ODBC version 1.13 loaded from
C:/Programme/Perl/site
/lib/DBD/ODBC.pm
<- install_driver= DBI::dr=HASH(0x1b6236c)
<- connect('Sage KHK 3.3.3' '' ...)= DBI::db=HASH(0x1bdf1c4) at
DBI.pm line
598
<- STORE('PrintError' 1)= 1 at DBI.pm line 645
<- STORE('AutoCommit' 1)= 1 at DBI.pm line 645
<- STORE('Username' '')= 1 at DBI.pm line 648
<> FETCH('Username')= '' ('Username' from cache) at DBI.pm line 648
<- connect= DBI::db=HASH(0x1bdf1c4)
<- STORE('dbi_connect_closure' CODE(0x1bdf104))= 1 at DBI.pm line 668
<- prepare('select Kontonummer from PeriodenumsaetzeSachkonten')=
DBI::st=HA
SH(0x1be8730) at test.pl line 21
<- DESTROY(DBI::st=HASH(1be8730))= undef
<- DESTROY(DBI::db=HASH(1bdf1c4))= undef
<- disconnect_all= '' at DBI.pm line 677
! <- DESTROY(DBI::dr=HASH(1b6236c))= undef during global destruction
The Script crashes always when it is ended. As soon as the
Destroy statements where executed.
Regards Bernd.