Thanks Brian, 
I finally got this working. The DBD->connect syntax I was using was correct. 
The reason it was failing was because I did not define the database(that I want 
to connect to ) in the DB2 client configuration. 
Once I did that I was able to connect to the database. I did not realized that 
it was necessary to configure the database first. I thought that the script 
would allow me to directly connect to it.
Anyways, here is my revised script for connection, in case anyone in the group 
want to use it.
*************************************
#!/usr/bin/perl
  use DBI;
  use DBD::DB2;
  use DBD::DB2::Constants;

$db= 'dbname';
$hostname='hostname';
$user='name';
$pass='password';
my $string = "dbi:DB2:DATABASE=$db; HOSTNAME=$hostname;";
my $dbh = DBI->connect($string, $user, $pass) || die "Connection failed with 
error: $DBI::errstr";
print "Connection is successful !!\n";
******************************************

Reply via email to