Code dump with DB2 V9.7 on Solaris with NULL

  • Andrew Watkins
    Andrew Watkins

    Having a problem with Technology Explorer and DB2 V9.7 when causes the httpd process to Segmentation fault.

    1) create table items (  id  int primary key not null,   brandname   varchar(30),  itemname    varchar(30),   sku  int,   srp     decimal(7,2),   comments    xml );

    2) insert into items values (3641, 'Text',  'Suit',  7811421, 149.99, NULL);

    3) select * from items;

    What happens is no results are displayed and you notice a exit signal Segmentation fault in apache log files.

    I have followed the exact same procedure with DB2 9.5 and it works correctly.

    Setup: Solaris 10 Zone
                 Solaris webstack 1.5 (also any apache)

                 DB2 v 9.7.0 (FAILS)

                 DB2 v9.5.1 (WORKS OK)

    Any pointers.


  • The segmentation fault is definitely happening between PHP and the IBM_DB2 driver.

    Do you have both DB2 V9.5 & V9.7 on the system?

    If so 2 possibilities that I have hit on other Unix systems.

    1) When compiling the IBM_DB2 driver you pointed to the V9.5 install
    2) You took the pre-compiled library from the V9.7 install but the global libraries on the system point to the V9.5 libraries

    I do not have access to a Solaris box, so I can only work on the assumption that this is a common Unix problem (here's hopping). Let me know if that helps I will keep thinking about the problem, but I will not get to try out my thoughts till later this week.

    Hope that helps


  • Thanks for the reply.

    I am doing this on two different Solaris zones. With exactly the same setup in both cases with the only difference being which version of DB2.
    machine 1 which fails: DB2 v9.7 + apache/php (webstack) + new install of + TE
    machine 2 which works: DB2 v9.5 + apache/php (webstack) + new install of + TE

    But when I run PHP code from the shell it works in both cases!

    $database = 'database';
    $user = 'username;
    $password = 'password';

    $conn = db2_connect($database, $user, $password);
    if ($conn) {
       echo "Connection succeeded.<br />";
       $sql = "SELECT comments FROM items ";
       $stmt = db2_prepare($conn, $sql);
       $movielist = array();

       while (db2_fetch_row($stmt)) {
          $movielist = db2_result($stmt, 0);
          echo "=$movielist=<br />\n\n";
          $i += 1;

       echo count($movielist) . " records.<br /><br />";
    else {
       echo "Connection failed.<br />";
       echo db2_conn_errormsg();

    which works and returns nothing with no error.

    /opt/webstack//bin/php   ibm.php
    Connection succeeded.<br />==<br />

    1 records.<br /><br />

    Is it possible that raw PHP does something different from TE software?


  • Andrew Watkins
    Andrew Watkins

    Just downloaded latest version v3.5.1326 and the problem has gone away. So thanks