-1

我必须将我的网络服务器(仅供内部使用)切换到更新的版本,所以我还有新的 perl 和新的 DBD:Sybase 而不是我以前使用的 DBD:ASAny。

我经常使用带有绑定变量的语句,它们运行良好,但是使用 DBD:Sybase 我得到以下错误:

AH01215:DBD::Sybase::st 执行失败:服务器>消息编号=12006 严重性=16 状态=0 行=0 文本=SQL Anywhere-Fehler >-110:元素 'DBD1' ist bereits vorhanden

版本:

新:DBD::Sybase

/usr/local/lib/x86_64-linux-gnu/perl/5.22.1/DBD/Sybase.pm 安装:1.15

旧:DBD::ASny

DBD::ASany 版本 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>";
}

违规行是“$sth_lager->execute($artnr)”

4

1 回答 1

0

感谢你们所有人,尤其是辛巴克,他走在了正确的轨道上。答案很简单:
DBD::ASAny 用于处理 SQL Anywhere,而 DBD::Sybase 用于 Sybase Adaptive Server Enterprise,这两个系统实际上完全不同。
我使用了错误的工具。薄雾。

于 2017-05-24T08:59:49.177 回答