Re: ERROR ORA-12154 TNS: could not resolve the connect identifier specified



On Mon, 13 Oct 2008 11:24:17 -0700 (PDT), beta <qlng2000@xxxxxxxxx>
wrote:

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



Stupid questions maybe, but anyway questions about this error are
always redundant as there is a plethora of resources, just *because*
people don't do anything to resolve it themselves:

Is the webserver located on the database server?
Did you run tnsping on the webserver or on the database server?
Do you have one or multiple tnsnames.ora floating around?
Did you set the TNS_ADMIN enviroment variable?
Please note similar questions have been asked to other people with the
same problem, so I have one final question:
Why didn't you bother to search the documentation or forums.oracle.com
or Usenet. Assum ing you are unioue? Or just lazy?
Just wondering...

--
Sybrand Bakker
Senior Oracle DBA
.



Relevant Pages

  • Re: Fully Allocate a Resource
    ... Contour and prioritization worked, ... levelling or even week-by-week levelling might be more ... If, after levelling, a resource is not working sufficiently many ... I was able to resolve the problem by changing the Work Contour ...
    (microsoft.public.project)
  • Re: Networking problem (addl info)
    ... Did 'ping' resolve the hostname? ... What browser are you ... not running in a virtual machine ...
    (comp.os.linux.setup)
  • Re: Project 2k3 Mail Issue
    ... reading it as plain text -- but I got enough to understand it isn't ... Resource From> Address book, do you still see the double issue? ... his/her name will appear twice in the To: ... The user's name does not resolve correctly from the GAL. ...
    (microsoft.public.project)
  • RE: TWO_TASK environment variable
    ... Copyright 1982, 2006, Oracle. ... ORA-12154: TNS:could not resolve the connect identifier specified ... Enter user-name: ... unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus ...
    (perl.dbi.users)
  • Re: BIND update?
    ... ask to resolve www.google.com, the answer does not mean "www.google.com is on the network at 74.125.19.104." ... Yes, yes, DNS makes no security guarantees, it's always been vulnerable, this is old old news. ... what's at issue is that you're choosing to let unknown and untrusted sites inject arbitrary data into your web browser. ... check old CERT advisories, attackers have been exploiting DNS cache vulnerabilities in home/soho routers/WAPs/firewalls for a while now. ...
    (FreeBSD-Security)