#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0

    Who sucefully link to the remote oracle server using php?
    I can't run it!
    Please help me!
    Thanks in advance


    --------------------------------------------------------------
    php 4.0.1pl2
    oracle 8i
    web server: NES 3.6

    Oracle is resident at another server,its sid is 'webdb' and
    service name is 'net.db.host.com'

    I set up oracle 8i client on the web server,and configure the
    netec which test ok.

    When I use tnsping and sqlplus,all works well,
    for example:
    tnsping net
    tnsping db
    tnsping db.host.com
    sqlpus scott/tiger@net

    But when I use php4 with oci8 support,all don't work!

    This is the example code and error message:
    source code:
    ----------------------------------------------------
    <?
    putenv("ORACLE_SID=webdb");
    putenv("ORACLE_HOME=/data/oracle/app/8.1.5");
    putenv("NLS_LANG=american.america.US7ASCII");

    $conn = OCIpLogon("scott/tiger@net.db.host.com","");
    if(!$conn)$conn=OCIpLogon("scott/tiger@webdb","");
    if(!$conn)$conn=OCIpLogon("scott/tiger@net","");

    if(!$conn)$conn=OCIpLogon("scott@net.db.host.com","tiger");
    if(!$conn)$conn=OCIpLogon("scott@webdb","tiger");
    if(!$conn)$conn=OCIpLogon("scott@net","tiger");

    if(!$conn)$conn=OCIpLogon("scott","tiger","net.db.host.com");
    if(!$conn)$conn=OCIpLogon("scott","tiger","webdb");
    if(!$conn)$conn=OCIpLogon("scott","tiger","net");

    if($conn)
    echo "sucessful!";
    else
    echo "<font color=red>Connect to database failed!";

    ?>
    ---------------------------------------------------------------
    The error message :
    ----------------------------------------------------------------

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 6

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 7

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 8

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 10

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 11

    Warning: _oci_open_server: ORA-12545: Connect failed because target host or object does not exist in /data/php/z.php on line 12

    Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in /data/php/z.php on line 14

    Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in /data/php/z.php on line 15

    Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in /data/php/z.php on line 16

    Connect to database failed!
    ---------------------------------------------------------------------

    This is the tnsnames.ora file on web server
    ---------------------------------------------------------------------
    # TNSNAMES.ORA Configuration File:/data/oracle/app/8.1.5/network/admin/tnsnames.ora
    # Generated by Oracle Net8 Assistant

    NET =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = db.host.com)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = net.db.host.com)
    )
    )

    --------------------------------------------------------------------

    This is the listener.ora on the oracle server
    --------------------------------------------------------------------
    # LISTENER.ORA Configuration File:/oracle/app/8.1.5/network/admin/liste
    # Generated by Oracle Net8 Assistant

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (PROTOCOL_STACK =
    (PRESENTATION = TTC)
    (SESSION = NS)
    )
    )
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.13)(PORT = 2481))
    (PROTOCOL_STACK =
    (PRESENTATION = GIOP)
    (SESSION = RAW)
    )
    )
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = db.host.com)(PORT = 1521))
    (PROTOCOL_STACK =
    (PRESENTATION = TTC)
    (SESSION = NS)
    )
    )
    )

    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /oracle/app/8.1.5)
    (PROGRAM = extproc)
    )
    (SID_DESC =
    (GLOBAL_DBNAME = net.db.host.com)
    (ORACLE_HOME = /oracle/app/8.1.5)
    (SID_NAME = webdb)
    )
    )
    ----------------------------------------------------------
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0
    solved.
    add the nobody user to dba group

Similar Threads

  1. how to connect the oracle server
    By arihandro in forum Oracle Development
    Replies: 1
    Last Post: February 4th, 2004, 08:30 AM
  2. Dumping database to remote server
    By black_lotus in forum MySQL Help
    Replies: 1
    Last Post: January 28th, 2004, 03:13 PM
  3. oracle 9i database server re-installation
    By johnmills in forum Oracle Development
    Replies: 1
    Last Post: January 17th, 2004, 08:43 AM
  4. Replies: 0
    Last Post: January 14th, 2004, 05:30 PM
  5. retrieving PHP/MySQL data using flash from remote server
    By alexjclark in forum PHP Development
    Replies: 2
    Last Post: January 8th, 2004, 03:37 AM

IMN logo majestic logo threadwatch logo seochat tools logo