开发者

Why is Perl's DBI failing to connect to my cataloged DB2 database?

I've downloaded the IBM DBI package, including all the packages in my program as specified in the docs. I've cataloged the DB and can connect to it from the command line, but my DBI connect fails:

$dbh =  DBI->connect ("dbi:DB2:warehou1", user, pa开发者_JS百科ss) or die "Can't connect to sample database: $DBI::errstr";

Can't connect to sample database: [IBM][CLI Driver] SQL1031N  The database directory cannot be found on the indicated file system.  SQLSTATE=58031


Consider using the full connection string when DBI can't resolve a simple database name:

my $string = "dbi:DB2:DATABASE=$db; HOSTNAME=$hostname; PORT=$port; PROTOCOL=TCPIP; UID=$user; PWD=$pass;";
my $dbh = DBI->connect($string, $user, $pass) || die "Connection failed with error: $DBI::errstr";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜