Remote DB2 connectivity in Perl
am 25.08.2006 06:39:42 von dhirendraj
------=_NextPart_000_0162_01C6C82E.95C95B90
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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
------=_NextPart_000_0162_01C6C82E.95C95B90--
Re: Remote DB2 connectivity in Perl
am 25.08.2006 16:24:51 von db2perl
--=_alternative 004F4A95862571D5_=
Content-Type: text/plain; charset="US-ASCII"
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"
08/24/2006 11:39 PM
To
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
--=_alternative 004F4A95862571D5_=--
RE: Remote DB2 connectivity in Perl
am 25.08.2006 16:42:25 von dhirendraj
------=_NextPart_000_01D6_01C6C882.C82CF110
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi,
It gives the following error message:-
DBI connect('DATABASE=hpcindb; HOSTNAME=172.30.0.180; PORT=56000;
PROTOCOL=TCPIP
; UID=hpcinst; PWD=hpcin007pwd;','hpcinst',...) failed: [IBM][CLI Driver]
CLI000
4W Invalid connection string attribute. SQLSTATE=01S00 at Noname1.pl line
13
Connection failed with error: [IBM][CLI Driver] CLI0004W Invalid connection
str
ing attribute. SQLSTATE=01S00 at Noname1.pl line 13.
Regards,
Dhirendra Jha
_____
From: Kellen F Bombardier [mailto:kfbombar@us.ibm.com] On Behalf Of db2perl
Sent: Friday, August 25, 2006 7:55 PM
To: Dhirendra Jha
Cc: dbi-users@perl.org
Subject: Re: Remote DB2 connectivity in Perl
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"
08/24/2006 11:39 PM
To
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
------=_NextPart_000_01D6_01C6C882.C82CF110--