#Creating dsn from command line arguments. $dsn = "HOSTNAME=" . $ARGV[0] .

";PORT=" . $ARGV[1] . ";DATABASE=" . $ARGV[2] . ";PROTOCOL=TCPIP" . ";UID=" . $ARGV[3] . ";PWD=" . $ARGV[4];

print "Trying to establish connection...\n"; $dbh = DBI->connect("dbi:DB2:$dsn",

"", "", {PrintError => 0}

) die "Database connection not made: $DBI::errstr"; print "Connection successful.\n";

print "Closing connection...\n"; $dbh->disconnect();

print "Connection closed.\n";

266DB2 Deployment Guide

Page 280
Image 280
IBM manual 266 DB2 Deployment Guide