SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    England
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP ODBC_CONNECT to DB2 - help!

    Hi

    We have a problem using the PHP unified ODBC function odbc_connect() to access a remote database :

    We have a server running a DB2 UDB database for Linux

    We are attempting to access this database from an application server that is running PHP and Apache on Linux. On this server we have installed DB2 Connect and the DB2 Application Development Client.

    On the application server we have catalogued the remote database as follows:

    Database Directory

    Database alias = WEBPRD01
    Database name = WEBPRD01
    Node name = MYBBB01
    Database release level = 9.00
    Directory entry type = Remote
    Catalog node number = -1

    Node Directory

    Node Name = MYBBB01
    Protocol = TCPIP
    Hostname = mybbb01.mybbb.co.uk
    Service Name = 3700

    From the command line we are able to connect to the database server successfully and issue an SQL select statement.

    However, when we try to access the remote database server via the following PHP script we get the following error:

    Warning: odbc_connect(): SQL error:, SQL State $ in SQl Connect

    PHP Script

    <?php

    $dsn = "WEBPRD01";
    $user = "******";
    $password = "*******";

    $conn = odbc_connect($dsn,$user,$password);
    ?>

    We have compiled PHP with the appropriate "--with-ibm-db2=/home/db2inst1/sqllib" configuration parameter.

    It seems as though the problem revolves around the PHP unified ODBC function odbc_connect() and its ability to connect to a remote database.
    Could anybody give us any clues as to what might be the problem ?

    Many Thanks in advance for any help you can offer

    Software Versions

    Application Server

    Linux: Red Hat 7.3
    Apache: 1.3.29
    PHP: 4.3.9
    DB2 Connect : DB2 Connect Personal Edition 7.2

    Database Server

    Linux: Red Hat 7.3
    DB2 : DB2 7.1 Fixpack 7 (DB2 v7.1.0.68)

  2. #2
    SitePoint Member
    Join Date
    Nov 2004
    Location
    England
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Problem Resolved !

    We have resolved our own problem.

    For the info of others, the problem was due to the fact that the user id the webserver was running as did not have access rights to the databases, despite the fact that we were using the correct user and password within the odbc_connect call in the PHP script.

    Hope this helps others in the future !

  3. #3
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •