ERROR ORA-12154 TNS: could not resolve the connect identifier specified
Date: Mon, 13 Oct 2008 11:24:17 -0700 (PDT)
Message-ID: <57220fa2-4a55-422b-b943-e6d32d697354@s20g2000prd.googlegroups.com>
Hi,
I have a strange problem with oracle connection. It gives a "ERROR ORA-12154 TNS: could not resolve the connect identifier specified" srror on the browser.
Here is my oraConnect.php ############## <?php
$conn = OCILogon("hr", "hr", 'demo'); $query = 'select * from hr.jobs';
$stid = OCIParse($conn, $query);
OCIExecute($stid, OCI_DEFAULT);
while ($succ = OCIFetchInto($stid, $row)) {
foreach ($row as $item) { echo $item." "; } echo "<br>\n";
}
?>
#### OUT put
# php oraConnect.php
AD_PRES President 20000 40000 <br> AD_VP Administration Vice President 15000 30000 <br> AD_ASST Administration Assistant 3000 6000 <br> FI_MGR Finance Manager 8200 16000 <br> FI_ACCOUNT Accountant 4200 9000 <br> AC_MGR Accounting Manager 8200 16000 <br> AC_ACCOUNT Public Accountant 4200 9000 <br> SA_MAN Sales Manager 10000 20000 <br>
### TNSNAME / tnsping
# tnsping demo
TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 13- OCT-2008 11:20:30 Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.1.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST
= xxx.xxxx.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = demo)))
OK (0 msec)
#### browser
http://localhost/oraConnect.php
Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not
resolve the connect identifier specified in /opt/www/oraConnect.php on
line 2
Warning: ociparse() expects parameter 1 to be resource, boolean given in /opt/www/oraConnect.php on line 5
Warning: ociexecute() expects parameter 1 to be resource, null given in /opt/www/oraConnect.php on line 6
Warning: ocifetchinto() expects parameter 1 to be resource, null given in /opt/www/oraConnect.php on line 7
Thanks mycn,
Beta
Received on Mon Oct 13 2008 - 13:24:17 CDT