iskibinska
asked on
stored procedure call not working from PHP on iseries
hi , i have a simple stored procedure to retrieve customer name , it works fine in interactive
SQL, but when i use it in php it does not work,
$Sql1 = "SELECT fld1,fld2,fld3,
custname(fld2,fld3)
from $dtalib.ORDERS";
var_dump($Sql1);
$result = db2_exec($QSYS2_conn, $Sql2);
var_dump($result);
The result is false, the stored procedure is in QGPL which is in ZEND library list, how can i get more diagnostic here
SQL, but when i use it in php it does not work,
$Sql1 = "SELECT fld1,fld2,fld3,
custname(fld2,fld3)
from $dtalib.ORDERS";
var_dump($Sql1);
$result = db2_exec($QSYS2_conn, $Sql2);
var_dump($result);
The result is false, the stored procedure is in QGPL which is in ZEND library list, how can i get more diagnostic here
ASKER
Hi Gary,
It works fine, when I remove custname, so everything is fine in tha respect, connection is fine,
it is like this actually (it was a typeo)
$Sql2 = "SELECT fld1,fld2,fld3,
custname(fld2,fld3)
from $dtalib.ORDERS";
var_dump($Sql2);
$result = db2_exec($QSYS2_conn, $Sql2);
var_dump($result);
The error says CUSTNAME in *LIBL type *N not found. SQLCODE=-204, but as I run the sql2 interactively
everything is fine
It works fine, when I remove custname, so everything is fine in tha respect, connection is fine,
it is like this actually (it was a typeo)
$Sql2 = "SELECT fld1,fld2,fld3,
custname(fld2,fld3)
from $dtalib.ORDERS";
var_dump($Sql2);
$result = db2_exec($QSYS2_conn, $Sql2);
var_dump($result);
The error says CUSTNAME in *LIBL type *N not found. SQLCODE=-204, but as I run the sql2 interactively
everything is fine
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much it worked.
ASKER
With qualified name I wanted to add
Great. Thanks for posting back with that.
- Gary
- Gary
1) Is your db2_conn call (not shown) succeeding? Does the user profile that you are running under have rights to read the ORDERS table? What connections options are you using, if any?
2) You are setting and dumping $Sql1 in the example, but then passing $Sql2 on the db2_exec call. Is that what you mean to do? What's in $Sql2?
3) You can get the specific error message using the db2_stmt_error and db2_stmt_errormsg functions:
http://www.php.net/manual/en/function.db2-stmt-error.php
http://www.php.net/manual/en/function.db2-stmt-errormsg.php
- Gary Patterson