php to derby database connection fails..urgent ..pls help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • knellim
    New Member
    • Feb 2010
    • 23

    php to derby database connection fails..urgent ..pls help!

    I can connect to DB2 on the command line on the server.

    db2=>connect to mytest user knellim using xxxx

    Database Connection Information

    Database server = Apache Derby CSS10050
    SQL authorization ID = KNELLIM
    Local database alias = MYTEST

    When I connect to the same DB in PHP as cataloged or uncataloged, I get
    this:

    Connection to database failed.
    SQLSTATE:
    Message:
    Below is my script

    Code:
    <?php
    
    $database = 'mytest';
    $user = 'knellim';
    $password = 'xxxx';
    
    $conn = db2_connect($database, $user, $password);
    
    if ($conn) {
       echo "Connection succeeded.";
       db2_close($conn);
    }
    else {
       echo "Connection failed.<p>";
       echo 'SQLSTATE: ' . db2_conn_error() . '<br />';
       echo 'Message: ' . db2_conn_errormsg(). '<br />';
    }
    ?>
    I followed this link http://www.db2ude.com/?q=node/81 to install ibm_db2 driver
    I installed Apache using yum install httpd -y

    Please suggest what can be the problem...

    Thanks
    Last edited by Atli; Feb 22 '10, 11:24 PM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    It's odd that the db2_conn_error and db2_conn_errorm sg functions don't return anything. If the connection fails, they should.

    Do you have the error messages turned on? Could be that there is an underlying problem that is being suppressed.

    Comment

    • knellim
      New Member
      • Feb 2010
      • 23

      #3
      I tried the method to unsuppress the messages by adding these to php code
      # error_reporting (E_ALL);
      # ini_set('displa y_errors', true);

      But still i get same error
      Connection failed.SQLSTATE value:
      Segmentation fault


      Why m I getting a segmentation error.. Is this the reason..
      Pls help..!

      Comment

      Working...