tags:

views:

179

answers:

1

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, pass) 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
+2  A: 

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";
mobrule
I was hoping to avoid having to do that by cataloging all my DBs.
Buzkie
Then check `DBI->data_sources('DB2')` to see whether your cataloging was successful. Debugging the cataloging could be very different from debugging the DBI setup. Don't try to solve both problems at once.
mobrule