Topic
4 replies Latest Post - ‏2014-06-06T07:45:24Z by carlolunghi
carlolunghi
carlolunghi
4 Posts
ACCEPTED ANSWER

Pinned topic Trouble with PDO_ODBC

‏2014-05-07T21:07:46Z |

Dear Colleagues,

I'm having trouble to access db2 on iSeries. Tthe customer needs to access a DB2 database implemented on an iSeries V5R4 from a PHP application running on a Linux CentOS 64 bit machine. He plans to migrate to V6 - already acquired - after implementing functions to read/update the DB2 db from his web applications PHP coded and processed under Zend Server.  
I'm working to realize the following software architecture running on a Linux CentOS 6.5 server:
level 1 - php application,
level 2 - Zend Server (6.3) - PHP (5.3.28)
level 3 - IBM PDO_ODBC
level 4 - unixODBC driver manager
level 5 - iAccess.
The installed product versions are:
1) [yum list installed |grep -i unix]
unixODBC.x86_64                              2.2.14-12.el6_3           @base
2) [from Zend administration page]
PDO_ODBC (ODBC Drivers / IBM DB2 CLI PHP Database Access) 1.0.1
3) [From the Entitlement Software Support (ESS) website on behalf of my customer I got the file <<IBM_i_Access_Client_Solutions_-_Linux_AP_LCD8_2012_01>>]
ibm-iaccess-1.1.0.1-1.0.x86_64.rpm

On such a platform I run isql successfully. When I move to php I get:

Warning: PHP Startup: Unable to load dynamic library
'/usr/local/zend/lib/php_extensions/ibm_db2.so' - libdb2.so.1: cannot open
shared object file: No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library
'/usr/local/zend/lib/php_extensions/pdo_ibm.so' - libdb2.so.1: cannot open
shared object file: No such file or directory in Unknown on line 0 connessione

The first question comes from such warnings: where are they coming from ? Could the installation be partially completed ?

The second question comes from the following program: it simply does not work and falls in segmentation fault.

$name = 'giovanni';
$name2= $name;
$db_user = "xxxx";
$db_pass = "xxxx_pswd";
$username = $db_user;
$password = $db_pass;
try {
        $dbh = new \PDO("odbc:PUB5",
                        "$username",
                        "$password"
        );
} catch (PDOException $exception) {
        echo $exception->getMessage();
        exit;
}
echo "connessione ok";
$nome = "giovanni";

        $stmt = $dbh->prepare("INSERT INTO RESTTEST.MENU_TEST (USERNAME) VALUES  ( :nome ) ");
        $stmt->bindParam(':nome', $nome , PDO::PARAM_STR,strlen($name));
        $stmt->execute();
        $stmt->debugDumpParams();

The program, in which the variable name or nome, is enclosed by simple (') or double (") string delimiters, does not work but it works fine if the variable is defined static.   My test system is rather shaky. Could anyone please give me comments and suggestions ?

Many thanks for your cooperation.

carlo lunghi

  • carlolunghi
    carlolunghi
    4 Posts
    ACCEPTED ANSWER

    Re: Trouble with PDO_ODBC

    ‏2014-05-09T10:10:14Z  in response to carlolunghi

    Dear colleagues.

    I find the following messages in the core dump of Apache:

    0x00007f2b7e69a0c5 in odbcConv_PreConvert_C_CHAR(STATEMENT_INFO&, char const*&, unsigned long&, COLUMN_INFO&) () from /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so

    Does anyone recognize a known problem ? or have any suggestion to fix or workaround it ?

    Thanks a lot.

    carlo lunghi

     

     

    • carlolunghi
      carlolunghi
      4 Posts
      ACCEPTED ANSWER

      Re: Trouble with PDO_ODBC

      ‏2014-05-09T13:15:12Z  in response to carlolunghi

      Dear Colleagues,

      I found in https://bugs.php.net/bug.php?id=46473 an explanation of the failure. It attaches to the IBM 64-bit iSeriesAccess ODBC Driver the full responsibility for the mistakes. I do not know if it's true. But I would not use 32-bit machines completely unpresentable, nor ask the customer to implement a new one. I would like to know if it is true, and in case, if there is new software in order to pursue the open software solution that I presented to my customer.
      I would also like some suggestions in principle and in design.

      Really I do not know what to do.

      Thanks for the cooperation.

      carlo lunghi

      • kadler
        kadler
        12 Posts
        ACCEPTED ANSWER

        Re: Trouble with PDO_ODBC

        ‏2014-06-04T15:39:36Z  in response to carlolunghi

        Hi Carlo, unfortunately there is a known incompatibility with the ACS Linux ODBC driver and pdo_odbc - I have a post in the forums describing the problem. To be clear, this is a problem with pdo_odbc, not with the ODBC driver IBM provides. I see that the bug was finally fixed, but I'm not sure when a release with that fix will be available from php or from CentOS - you will need to inquire with them.

        In the interim, you have 3 options:

        1. Compile pdo_odbc from git or patch pdo_odbc and recompile
        2. Switch to 32-bit for php, odbc, and apache
        3. Use php-odbc instead of pdo_odbc
        4. Switch back to iSeriesAccess for Linux 7.1
        • carlolunghi
          carlolunghi
          4 Posts
          ACCEPTED ANSWER

          Re: Trouble with PDO_ODBC

          ‏2014-06-06T07:45:24Z  in response to kadler

          Hallo Kadler,

          very happy for your attention and response.

          I'll follow the item n. 1 that appears to me to be potentially the solving one.

          And able to go also with 6.1 (my customer is moving now to V6, production being still in V5R4).

          I'll keep you informed about my results, said in a couple weeks.

          Thanks for your cooperation.

          Regards.

          c.l.