Folks,
I have tried to use many different combinations of trying to call a DB2
stored procedure through a cgi script but this is what I see in the error
logs, "[Fri Aug 20 10:46:56 2004] mail2_form.pl: DBD::ODBC::st execute
failed: [IBM][CLI Driver][DB2] SQL0440N No function by the name
"EPOSP511" having compatible arguments was found in the function path.
SQLSTATE=42884"
I have already made sure that the stored procedure exists in the region
where I am connecting to on the mainframe and the prepare call also has
the fully qualified name of the stored procedure. I can call the stored
procedure from the region where it is supposed to run through DB2 Connect,
but on using DBI:ODBC I get the above error message.
I am also attaching the code to have a few more sets of eyes have a look
at it in case there is something that I have missed. Another thing that I
notice in the output is that there is a message, "Can't call method commit
on an undefined value at mail2_form.pl line 80." I presume this is
something to do with the parameter not getting the value it is supposed to
get when binding.
Any help in trying to get this working would be greatly welcome.
Thanks in advance,
Samarth
use DBI;
use CGI qw( :standard );
use CGI::Carp qw( warningsToBrowser fatalsToBrowser );
my $subsystem = "DD0G";
my $username = "";
my $password = "";
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" );
my $dbh = DBI -> connect( "DBI:ODBC:$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.EPOSP511('AVGI04','CIA','WECIAINT','CREWNET','2004-08-19-16.25.32.948427','N',0,0,0,'
',' ','Y',?)} );
$sth -> bind_param( 1, '\'17699\'' );
$sth -> execute();
if( $@ ) {
print( "execute failed" );
$dbh -> disconnect;
exit;
}
print( "Executed stored procedure" );
$sth -> commit;
$sth -> finish();
$dbh -> disconnect();
print( "\n</body>" );
print( "</html>\n" );