| Newsgroups |
perl.dbi.users |
| Message-ID |
<[email protected]> |
Hello all,
Any help with this would be appreciated. I'm trying to connect to a db2 database on localhost using IIS. I have ActivePerl installed as well as its DB2 database driver. I can execute a .pl script with no issues but cannot connect to my DB2 database using the following Perl script as an example. I get the following error: "Total Environment allocation failure! Did you set up your DB2 client environment? at c:\inetpub\wwwroot..." Has anyone tried connecting to a DB2 database using localhost - does anyone have any examples? Am I missing some environment variables? I can't find any relevant examples online. I would really appreciate some guidance - thank you for your time.
#!/usr/local/bin/perl -w
use DBI;
use DBD::DB2;
use strict;
# Open a connection
my $dbh = DBI->connect("dbi:DB2:databasename:localhost:50000","username","password", {RaiseError => 1});
# use VALUES to retrieve value from special register
my $stmt = "Values CURRENT DATE";
my $sth = $dbh->prepare($stmt);
$sth->execute();
# associate variables with output columns...
my $col1;
$sth->bind_col(1,\$col1);
while ($sth->fetch) { print "Today is: $col1\n"; }
$sth->finish();
$dbh->disconnect();
Regards,
--Keith Howell