perl在LINUX下通过FREETDS连接SQL 2000的问题

perl在LINUX下通过FREETDS连接SQL 2000的问题

如下代码:

[Copy to clipboard] [ - ]
CODE:
use DBI qw(:sql_types);
my $dbh;
&connect_db;
sub connect_db
{
    # my ($DBserver)=@_;
    my ($DBserver)="db1";
    $try_nums = 10;
    print "access111 \n";
    $dbh = DBI->connect( "dbi:Sybase:$DBserver;charset=eucgb", "sa", "123456", { AutoCommit>=1 } ) or print("数据库连接错误\n");
   print"access \n";
    while(($dbh==0)&&($try_nums>0))
    {
        $try_nums--;
        sleep(60);
        $dbh = DBI->connect( "dbi:Sybase:$DBserver;charset=eucgb", "sa", "123456", { AutoCommit>=1 } ) or print("数据库连接错误\n");
    }
    if($dbh == 0){
        print("数据库连接错误");
    }
    else{
        print("数据库连接错误");
    }
$dbh->disconnect();
}
print"access22 \n";
exit(0);

运行时报告:

[Copy to clipboard] [ - ]
CODE:
perl mbtest.pl
access111
DBI connect('db1;charset=eucgb','sa',...) failed: OpenClient message: LAYER = (6) ORIGIN = (8) SEVERITY = (5) NUMBER = (1)
Server , database
Message String: ct_connect(): directory service layer: internal directory control layer error: There was an error encountered while binding to the directory service.
at mbtest.pl line 12
数据库连接错误
access

但是通过Tsql又可以正常连接数据库。

请问这个是什么问题引起来的?

要怎么解决?

谢谢

用 DBD::FreeTDS 吧,如果 DBD::Sybase 搞不定的话。
http://search.cpan.org/~timb/dbd-summaries/dbd-freetds.pod