PHP-ORACLE-WINNT-OCI8: _oci_open_server: ORA-12154: TNS: could not resolve
| From: | Jorge Calvera | Date: | Mon, 08 Jan 2001 09:37:45 +0000 |
| Subject: | PHP-ORACLE-WINNT-OCI8: _oci_open_server: ORA-12154: TNS: could not resolve | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5699@lists.php.net to get a copy of this message | ||
Hi,
I have PHP4.0.2 for Windows (www.php4win.de) working in a Windows
NT4 (SP6a) and Oracle Client for NT, Release 8.0.5.
When I try to connect to a remote Oracle DB, I got this err msg:
_oci_open_server: ORA-12154: TNS: Could not resolve service name.
This seems to be a TNSNAMES.ORA problem, but tnsping80.exe and
sqlplus works fine.
I have the following environment variables in my profile environment:
ORACLE_BASE=e:\orant
ORACLE_HOME=e:\orant
TNS_ADMIN=e:\orant\net80\admin\tnsnames.ora
ORACLE_SID=ORCL
I have copied the tnsnames.ora file in :
c:\winnt
c:\php (PHP installation directory)
c:\
e:\orant
e:\orant\net80\admin\ (default directory)
e:\orant\network\admin\
I execute from a DOS box:
C:\php>php oci_sample.PHP
Please, help!
Thanks in advance,
Jorge
One more thing, when I try with the line (without db param):
OCILogon("scott", "tigger");
I got this error: _oci_open_server: ORA-12203: TNS: Could not connect to
....
In the sqlnet.log, I got:
********************* SQLNET.LOG ********************************
Fatal NI connect error 12203, connecting to:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle80)(ARGV0=o
racle80ORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')))(CON
NECT_DATA=(SID=ORCL)(CID=(PROGRAM=C:\php\php.exe)(HOST=MI_PC_NAME)(USER=MI_N
T_ACCOUNT_NAME))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.0.5.0.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 8.0.5.0.0 -
Production
Time: 08-ENE-01 10:30:02
Tracing not turned on.
Tns error struct:
nr err code: 12203
TNS-12203: TNS:no se puede conectar con el destino
ns main err code: 12560
TNS-12560: TNS:error del adaptador de protocolo
ns secondary err code: 0
nt main err code: 530
TNS-00530: Error del adaptador de protocolo
nt secondary err code: 0
nt OS err code: 0
*******************************************************
My question is that I haven't got defined ORCL that way anywhere!!!!
(LOCAL, BEQ, MY-HOST, .....)
This seems to be some default-values my php_oci8.dll is getting ¿?¿?¿??
----------- oci_sample.PHP -------------------
// I have tried with and without this code.
/*
putenv('ORACLE_BASE="e:\orant"');
putenv('ORACLE_HOME="e:\orant"');
putenv('TNS_ADMIN=e:\orant\net80\admin\tnsnames.ora');
putenv('ORACLE_SID=ORCL');
*/
OCILogon("scott", "tigger", "ORCL");
--------------------------------------------------
----------- TNSNAMES.ORA ---------
# E:\ORANT\NET80\ADMIN\TNSNAMES.ORA Configuration
File:E:\orant\net80\admin\tnsnames.ora
# Generated by Oracle Net8 Assistant
ORCL.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = XX.YY.ZZ.WW)(PORT = 1521))
(CONNECT_DATA = (SID = ORCL))
)
---------------------------------------------