php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5569 Ocilogon can't login remote oracle server?But sqlplus works fine!
Submitted: 2000-07-13 20:51 UTC Modified: 2006-07-17 08:09 UTC
From: lhf at mail dot 2932 dot com dot cn Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.0.1pl2 OS: Solaris 2.6
Private report: No CVE-ID: None
 [2000-07-13 20:51 UTC] lhf at mail dot 2932 dot com dot cn
Ocilogon can't login remote oracle server?But sqlplus works fine!

--------------------------------------------------------------
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 net.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)
    )
  )
----------------------------------------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-14 08:50 UTC] lhf at mail dot 2932 dot com dot cn
ok,all fine after I add the nobody user to group dba
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 00:05:45 2022 UTC