Folks,
I am trying to call a DB2 stored procedure through a TeamSite CGI script that is supposed to return multiple rows. However, on running the script nothing is returned. If the same call is made through the DB2 Connect Client the stored procedure is executing and returning the rows back. I have attached the code with this post.
Any thoughts on where I might be going wrong will be greatly welcome.
Samarth
#!j:\iw-perl\bin\iwperl
use DBI;
use CGI qw( :standard );
use CGI::Carp qw( warningsToBrowser fatalsToBrowser );
my $subsystem = "DD0G";
#my $collectionID = "AVGI00";
my $username = "WECIAINT";
my $password = "CIA321IN";
#my $applicationName = "CIA";
#my $applicationID = "CREWNET";
#my $timestamp = "2004-08-09-11.20.32.948427";
#my $esevere = "N";
#my $enum = "0";
#my $egroup = "0";
#my $esqlcd = "0";
#my $epgm = " ";
#my $etext = " ";
#my $edbavail = "Y";
#my $esqlca = " ";
print( "Content-type: text/html\n\n" );
print( "<html>\n" );
print( "<head>\n" );
print( "\t<title>DBI Connection Test</title>\n" );
print( "</head>\n" );
print( "<body>\n" );
DBI->trace(15, "myscript.trc");
my $dbh = DBI -> connect( "DBI

DBC:$subsystem", "$username", "$password" );
if( !$dbh ) {
print( "Unable to connect to database!!" . DBI -> errstr );
exit;
}
else {
print( "Connected to DB2!!\n" );
}
my $sth = $dbh -> prepare( q{ CALL DD0GWIN1.EPOSP529('AVGI04','CIA','WECIAINT','CREWNET','2005-03-17-12.26.41.469562','N',0,0,0,' ',' ','Y',' ','SAMARTH') } );
$sth -> execute();
if( $@ ) {
print( "Execute stored procedure failed" );
$dbh -> disconnect;
exit;
}
print( "Executed stored procedure" );
do {
while (my
@row = $sth->fetchrow_array()) {
print( "<p>" . "$row[0]" . " " . "$row[1]" . " " . "$row[2]" . " " . "$row[3]" . " " . "$row[4]" . " " . "$row[5]" . " " . "$row[6]" . " " . "$row[7]" . " " . "$row[8]" . " " . "$row[9]" . " " . "$row[10]" . " " . "$row[11]" . " " . "$row[12]" . " " . "$row[13]" . " " . "$row[14]" . " " . "$row[15]" . " " . "$row[16]" . " " . "$row[17]" . " " . "$row[18]" . " " . "$row[19]" . " " . "$row[20]" . " " . "$row[21]" . " " . "$row[22]" . " " . "$row[23]" . " " . "$row[24]" . " " . "$row[25]" . " " . "$row[26]" . " " . "$row[27]" . " " . "$row[28]");
}
}while( $sth->{db2_more_results} );
$dbh -> commit;
$sth -> finish();
$dbh -> disconnect();
print( "\n</body>" );
print( "</html>\n" );