Perl DBI connect()无法建立连接,并且未返回错误消息
当我试图建立到数据库的连接时,它失败了。但它也不会返回任何错误消息 代码如下所示Perl DBI connect()无法建立连接,并且未返回错误消息,perl,perl-module,dbi,Perl,Perl Module,Dbi,当我试图建立到数据库的连接时,它失败了。但它也不会返回任何错误消息 代码如下所示 my $dbh; $dbh = DBI->connect('DBI:SQLAnywhere:', $connString, undef, {PrintError => 0, PrintWarn => 0})or die "died",$DBI::errstr,"\n"; #dbh = DBI->connect('DBI:SQLAnywhere:', $connString)
my $dbh;
$dbh = DBI->connect('DBI:SQLAnywhere:', $connString, undef, {PrintError => 0, PrintWarn => 0})or die "died",$DBI::errstr,"\n";
#dbh = DBI->connect('DBI:SQLAnywhere:', $connString);
# setting up the authentication signature for the connection
print "$dbh";
if($dbh)
{
if(DbAuth::AuthenticateConnection($dbh))
{
return($dbh,$DbAuth::errstr) if (wantarray());
}
}
if (wantarray())
{
# The caller is prepared to deal with errors, so pass back the
# error string. It should only be used when the db_handle is 0.
return ($dbh, $DBI::errstr);
}
else
{
return $dbh;
}
知道为什么会发生这种情况吗?我如何调试这个问题
注意:我将perl从5.8升级到5.24没有perl 1.8和perl 1.24。您可能指的是Perl5.8和Perl5.24。我怀疑您是否接近Perl版本1。如果没有任何输出,您怎么知道它会失败?你能描述一下“失败”吗?还有,这是子程序的一部分吗?请显示您如何调用它。如果在连接中使用
RaiseError=>1会发生什么情况?@simbabque yes my bad。换了now@stevieb当我打印dbh时,它显示它没有任何值。这就是为什么我认为它失败了。是的,这是一个子程序。下面是它的名称:$node_dbh=&dbinternal::connect(“dsn=$dsn”);