DBI connect()无法建立连接,并且不会返回错误消息

时间:2017-07-04 13:02:59

标签: 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);
    # 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

0 个答案:

没有答案