php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59325 db2_execute(): Statement Execute Failed
Submitted: 2010-07-27 17:23 UTC Modified: 2015-09-03 13:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: aaron dot hawley at vtinfo dot com Assigned:
Status: Not a bug Package: ibm_db2 (PECL)
PHP Version: 5.3.1 OS: i5/OS
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aaron dot hawley at vtinfo dot com
New email:
PHP Version: OS:

 

 [2010-07-27 17:23 UTC] aaron dot hawley at vtinfo dot com
Description:
------------
Unable to run a stored procedure with db2_prepare and db2_execute. Get the error: 38501 Trigger program or external routine detected an error. SQLCODE=-443

Attached is the script we are using. It takes 7 parameters, with the first 3 as input and the last 4 as outputs.  This stored procedure has been debugged and it succeeds, but nothing is returned to PHP after the warning.  We are able to successfully call this stored procedure from Java.

We have had success calling from PHP a different stored procedure with 2 parameters in the same library (database) one input and one output, so stored procedures are working otherwise.

Occasionally, it will work flawlessly every so often from PHP -- like once a day with a few dozen tests.  We also run a stored procedure that "forces the job log" in the operating system, to see if we could get more information.  But calling that stored procedure first makes the problematic procedure run correctly.

I am using version 1.8.3 that comes with Zend Server 5.0.1 for IBM i. PHP version is 5.3.1.  Zend Server is running in v5r4 of the IBM i.

Reproduce code:
---------------
<?php

$params = array('host'     => 'host',
                'username' => '*******',
                'password' => '*******',
                'dbname'   => '*LOCAL',
                'driver_options' => array('i5_lib' => 'VVIP'));

$conn = db2_connect('*LOCAL', $params['username'], $params['password'],
                    $params['driver_options']);

$p_email = 'aaron.hawley <at> vtinfo.com';

$p_type = 'R';
$p_schema = '';
$p_user = '';
$p_password = '';
$p_num_rows = 0;

$stmt = db2_prepare($conn, "CALL Get_DB2_Attributes(?, ?, ?, ?, ?, ?, ?)");

db2_bind_param($stmt, 1, 'p_environment');
db2_bind_param($stmt, 2, 'p_email');
db2_bind_param($stmt, 3, 'p_type');
db2_bind_param($stmt, 4, 'p_schema', DB2_PARAM_OUT);
db2_bind_param($stmt, 5, 'p_user', DB2_PARAM_OUT);
db2_bind_param($stmt, 6, 'p_password', DB2_PARAM_OUT);
db2_bind_param($stmt, 7, 'p_num_rows', DB2_PARAM_OUT);

if (!db2_execute($stmt)) {
    printf("%s\n", db2_stmt_error($stmt));
    $err = db2_stmt_errormsg();
    die($err . "\n");
}
printf("%s %s %s %s %s %d\n", $p_environment, $p_email, $p_type, $p_schema, $p_user, $p_num_rows);


Expected result:
----------------
ENVIRONMENT aaron.hawley<at>vtinfo.com R TSCHEMA TUSER 0


Actual result:
--------------
PHP Warning:  db2_execute(): Statement Execute Failed in db2-call.php on line 30
Trigger program or external routine detected an error. SQLCODE=-443


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-28 05:21 UTC] abhargav at in dot ibm dot com
Hi,

After looking into the test case, it seems that '$p_environment' environment variable is not initialized before calling db2_execute() API. Please declare it first and then try the test case.

If problem still persist let me know.

Regards,
Ambrish Bhargava
 [2010-07-28 08:29 UTC] aaron dot hawley at vtinfo dot com
Sorry, I had mistakenly elided that line when making the post.  It is on the line above $p_email.  So, yes, the problem still persists.
 [2010-07-29 06:20 UTC] abhargav at in dot ibm dot com
Hi,

Can you provide me your client details? Is it running on System i itself or this is running on LUW client?

Regards,
Ambrish Bhargava
 [2010-07-29 10:17 UTC] aaron dot hawley at vtinfo dot com
We are running everything on the IBM i.

Let me know if you need more details.
 [2010-08-09 10:36 UTC] aaron dot hawley at vtinfo dot com
After upgrading to Zend Server 5.0.2 for IBM i, the same problem occurs.  The PHP version is 5.3.2 and the IBM DB2 module is version 1.8.4.
 [2010-12-29 14:36 UTC] michael at vtinfo dot com
After upgrading to Zend Server 5.0.4 for IBM i, the same problem occurs. PHP 5.3.3, IBM DB2 1.9.0.
 [2012-07-23 14:50 UTC] aaron dot hawley at vtinfo dot com
Turns out there was an error generated inside the stored procedure that was not being caught at the RPG-level and was never handled properly and passed to the user.  We came across these details in a spool file for the database user calling the procedure.  That solved the issue.
 [2015-09-03 13:23 UTC] rangercairns@php.net
-Status: Open +Status: Not a bug
 [2015-09-03 13:23 UTC] rangercairns@php.net
Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 08:01:29 2024 UTC