I have to switch my webserver (internal use only) to a more recent version and so I have also new perl and new DBD:Sybase instead of DBD:ASAny I used before.
I use statements with bind variables regulary, they worked fine, but with DBD:Sybase I get the following error:
AH01215: DBD::Sybase::st execute failed: Server >message number=12006 severity=16 state=0 line=0 text=SQL Anywhere-Fehler >-110: Element 'DBD1' ist bereits vorhanden
The versions:
New: DBD::Sybase
/usr/local/lib/x86_64-linux-gnu/perl/5.22.1/DBD/Sybase.pm Installed: 1.15
Old: DBD::ASAny
DBD::ASAny version 1.14.
#!/usr/bin/perl
use DBI;
print "Content-type: text/html\n\n";
$dbh = DBI->connect( "DBI:Sybase:server=tl", 'xxx', 'yyy', {PrintError => 1, AutoCommit => 0} ) or die "Connection failed\n Connection string: $connstr\n Error message : $DBI::errstr\n";
$dbh2 = DBI->connect( "DBI:Sybase:server=tl", 'xxx', 'yyy', {PrintError => 1, AutoCommit => 0} ) or die "Connection failed\n Connection string: $connstr\n Error message : $DBI::errstr\n";
$select="select artnr, bez1, bez2 from art where artnr like 'F%12%.00'";
$sth_t=$dbh->prepare($select);
$sth_t->execute();
$select="select lager_nr, bestand from bestand where art_nr = ? and coalesce(bestand,0) > 0 ";
$sth_lager=$dbh2->prepare($select) or die "Prep sthlager nix:".$dbh2->errstr()."\n";
while ( ($artnr, $gtnr, $bez)=$sth_t->fetchrow())
{
print $artnr."; ".$gtnr."; ".$bez;
$sth_lager->execute($artnr) or die "exec sthlager nix:".$dbh2->errstr()."\n";
while ( ($lager,$bestand) = $sth_lager->fetchrow())
{
print $lager." : ".$bestand." || ";
}
$sth_lager->finish();
print "\n<br>";
}
The offending line is "$sth_lager->execute($artnr)"