Home » RDBMS Server » Networking and Gateways » ORA-12154 error when trying to connect with PHP
ORA-12154 error when trying to connect with PHP [message #254208] Thu, 26 July 2007 03:01 Go to next message
aspectweaver
Messages: 3
Registered: July 2007
Junior Member
Hi,

I am using Oracle 8i (8.1.7.3), PHP(5.1.1), Apache(2.0.59), Win 2000 Server. Apache and PHP is installed correctly and I can see the phpinfo() page and oci8 is loaded as well.

My problem is that I can't connect to the db. When I try to connect to the db with ocilogon(), I get the ORA-12154 TNS:could not resolve service name error.

I can login to the db using SQL*Plus and SQLDeveloper using the same SID, username and pswd as I used in my php page.

My TNSNAMES.ORA, SQLNET.ORA files are below. There are 2 different TNSNAMES.ORA files in 2 different locations on the server. One is in F:\Oracle\Ora81\Network\Admin and the other one is in C:\Orant\Network\Admin. There is only one copy of SQLNET.ORA which is located in C:\Orant\Network\Admin.

TNSNAMES.ORA #1

Example1.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = Production1)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = SID1)
)
)
Example2.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = spx.world)
(PROTOCOL = SPX)
(Service = Server_lsnr)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
Example3.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = nmp.world)
(PROTOCOL = NMP)
(Server = FinanceServer1)
(Pipe = ORAPIPE)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
Tcp-loopback.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 127.0.0.1)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
Beq-Local.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = beq.world)
(PROTOCOL = BEQ)
(PROGRAM = oracle73)
(ARGV0 = oracle73ORCL)
(ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
prod244.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 200.2.3.244)
(Port = 1521)
)
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 200.2.3.244)
(Port = 1526)
)
)
(CONNECT_DATA = (SID = prod)
)
)
prod241.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 200.2.3.241)
(Port = 1521)
)
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 200.2.3.241)
(Port = 1526)
)
)
(CONNECT_DATA = (SID = prod)
)
)
prod.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = tnpark1)
(Port = 1521)
)
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = tnpark1)
(Port = 1526)
)
)
(CONNECT_DATA = (SID = prod)
)
)


TNSNAMES #2

PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = TNPARK1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = PROD)
)
)

SQLNET.ORA

TRACE_LEVEL_CLIENT = OFF
NAMES.DIRECTORY_PATH = (TNSNAMES)
names.default_domain = world
name.default_zone = world
names.default_domain=world


Any help would be greatly appreciated. Thanks!

[Updated on: Thu, 26 July 2007 03:44]

Report message to a moderator

Re: ORA-12154 error when trying to connect with PHP [message #254224 is a reply to message #254208] Thu, 26 July 2007 03:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
ora-12154: TNS:could not resolve service name
 *Cause:  The service name specified is not defined correctly in the
 TNSNAMES.ORA file.
 *Action:  Make the following checks and correct the error:
           - Verify that a TNSNAMES.ORA file exists and is in the proper
             place and accessible. See the operating system specific manual
             for details on the required name and location.
           - Check to see that the service name exists in one of the
             TNSNAMES.ORA files and add it if necessary.
           - Make sure there are no syntax errors anywhere in the file.
             Particularly look for unmatched parentheses or stray characters.
             Any error in a TNSNAMES.ORA file makes it unusable. See
             Chapter 4 in the SQL*Net V2 Administrator's Guide. If
               possible, regenerate the configuration files using the Oracle
               Network Manager.

Regards
Michel
Re: ORA-12154 error when trying to connect with PHP [message #254353 is a reply to message #254208] Thu, 26 July 2007 09:48 Go to previous message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
This is PHP coding problem; NOT an Oracle problem.
Previous Topic: Connect to Oracle 8.0.5 DB with a 10g client
Next Topic: How do i update the listener.ora file with a parameter.
Goto Forum:
  


Current Time: Fri Dec 02 18:36:29 CST 2016

Total time taken to generate the page: 0.32055 seconds