error while using perl:dbi to connect to access db2 data on mainframes
i am facing error while accesing db2 data using perl dbi on linux.
it gives a error
Cannot establish an ftp connection to host xxx.xxx.xxx.xxx at port 446. Error received: Bad file descriptor
the program i am executing is first.pl
use warnings;
use strict;
use DBI;
# All the queries will be routed to the DB2 subsystem DB2P
#
# jsmith/123456 must be a valid mainframe account able to query the tables of DB2P
#
my ($hostname,$port,$ssid) = ('xxx.xxx.xxx.xxx',446,'SHEF2282');
my ($username,$password) = ('username','password');
my $dbh = DBI->connect("dbi:MVS_FTPSQL:hostname=$hostname;port=$port;ssid=$ssid",$username,$password)
or die "Can't connect to database: $DBI::errstr\n";
#Prepares the query
my $sth = $dbh->prepare("SELECT * FROM EMPLOYE");
#Executes it
$sth->execute();
print "\tQuery results:\n================================================\n";
while ( my @row = $sth->fetchrow_array( ) ) {
print "@row\n";
}
warn "Problem in retrieving results", $sth->errstr( ), "\n"
if $sth->err( );
$sth->finish();
$dbh->disconnect();
~
~
Last edited by trickykid; 06-05-2008 at 09:24 AM.
Reason: Removed IP and Username/Passwords
|