PHP db_connect problems
I seem to have some weird problems when using db2sock libdb400.a and trying to connect to database using PHP db_connect.
This script fails when it is called through a running web server.
<?php
$db = "*LOCAL";
$user = "USER";
$password = "PASSWORD";
$options = array();
$result = db2_connect($db, $user, $password, $options);
var_dump($result);
if($result){
db2_close($result);
}
Error it gives is this, https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/codes/src/tpc/n950.html
[08-Feb-2018 09:32:16 Europe/Helsinki] PHP Warning: db2_connect(): Connection failure userid (THA) in /www/zendphp7/htdocs/dbconnect.php on line 7
[08-Feb-2018 09:32:16 Europe/Helsinki] PHP Warning: db2_connect(): Relaatiotietokantaa *LOCAL ei ole relaatiotietokantahakemistossa. SQLCODE=-950 in /www/zendphp7/htdocs/dbconnect.php on line 7
It works correctly if running straight from the command line
$ /usr/local/zendphp7/bin/php dbconnect.php
resource(4) of type (DB2 Connection)
It also works through the web server when I change libdb400.a back to the original.
Are you able to reproduce this problem?
Comments (3)
-
reporter -
Account Deleted Not SQLConnect per say ...
This is a problem with SQLOverrideCCSID400. I suspect your fastcgi.conf has SetEnv="CCSID=1208". I have new version works php web fastcgi.conf (Zend Server).
YIPS Super Driver - 1.1.3-sg6 - test driver - php web fix (Halmela)
more ...
PASE libdb400.a will be replaced by db2sock in future. Until replaced a db2sock hack in SQLAllocHandle and SQLAllocEnv should work with php and fastcgi.conf SetEnv="CCSID=1208".
-
reporter - changed status to resolved
Yes things seem to work again. And indeed there is CCSID="1208" in our fastcgi config, at least on one machine.
- Log in to comment
I did some investigation and it seems that this function in PaseCliAsync_gen.c is the culprit.
When running through my server it goes to the ILE_SQLConnect route and that doesn't work correctly. If I comment out the switch and only leave libdb400_SQLConnect things start to work again.
Why does it go to the ILE function when the ccsid comes back as UTF-*?