As the doc from http://search.cpan.org/~ibmtordb2/DBD-DB2-0.80/DB2.pod 
states, you can create a connection without a DSN quite easily.  Here is a 
small example:

#!/usr/bin/perl

use strict;
use DBI;
use DBD::DB2;

my $db = "mydb";
my $hostname = "myhostname";
my $port = 60000;
my $user = "dbuser";
my $pass = "dbpass";
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";

if ($dbh) {
  print "Connected\n";
} else {
  print "Not Connected\n";
}




"Dhirendra Jha" <[EMAIL PROTECTED]> 
08/24/2006 11:39 PM

To
<[email protected]>
cc

Subject
Remote DB2 connectivity in Perl






Hello Sir/Madam,
 
I am using the Active Perl for DB2 database automation. My DB2 database is
on Linux system. I want to connect the database from windows 
machine(without
DSN) using perl. I have installed all the perl module such as DBI, DBD, 
DB2,
Proxy, JDBC. Please provide me the information about this or it will be
better if you sned me small script for DB2 connectivity.
 
Regards,
Dhirendra Jha
 
 

Reply via email to