Re: Can't login remote oracle server? HELP!
| From: | Rasmus Lerdorf | Date: | Wed, 12 Jul 2000 06:24:45 +0000 |
| Subject: | Re: Can't login remote oracle server? HELP! | ||
| References: | 1 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-dev+get-24262@lists.php.net to get a copy of this message | ||
Try ocilogon("scott","tiger","net")
On Wed, 12 Jul 2000, lhf wrote:
> The last message is too slow,send,again
>
> 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
> os :Solaris 2.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)
> )
> )
> ----------------------------------------------------------
>
>
>