Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif
Without real information I can only wonder and guess.

Is TNS_ADMIN set to a directory or a file?  It should be a directory.
Try renaming sqlnet.ora temporarily or set the alias in tnsnames.ora
to something like "testdb.boo.com = (DESCRIPTION = ..."

Chris

neil smith wrote:
> Hello chris,
>
> I've modified the variables in the apache user environment (in my case
> root at the moment) but that didn't amke any difference to php not being
> able to find tnsnames.ora. So the work around I've used is to use
> ORACLE_SID="desciption(...etc..... SID = )))"; ie the full description
> of the database alias within tnsnames.ora
>
> However this is not good, so if you have any other idea please let me
> know. I'm flumuxed.
>
> thanks,
>
> neil
>
>
> >From: Christopher Jones <christopher.jones@oracle.com>
> >To: neil smith <neil989@hotmail.com>
> >CC: php-db@lists.php.net, n.a.smith@chello.nl
> >Subject: Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can
> connectif description hardcoded
> >Date: Wed, 20 Apr 2005 09:25:12 +1000
> >
> >Make sure the environment variables are set in the shell that starts
> >Apache.  See
> >http://www.oracle.com/technology/te...
.html#envvars
>
> >
> >Try changing your OCILogon command to
> >
> >   $odbc =
> OCILogon("yourusername","yourpassword",$db);
> >
> >i.e. remove "/test" from the username parameter.
> >
> >Chris
> >
> >neil smith wrote:
> >>Hello,
> >>
> >>I have test script that can connect to the oracle database. It
> >>doesn't
> >>require tnsnames.ora because I define the database alias in the
> >>script
> >>itself. It looks like this:
> >>
> >>
> >>
> >>echo
> "TWO_TASK=".getenv("TWO_TASK")."<br>";
> >>echo
> "LD_LIBRARY_PATH=".getenv("LD_LIBRARY_PATH")."<
;br&gt;";
>
> &gt;&gt;echo
> "ORACLE_BASE=".getenv("ORACLE_BASE")."&lt;BR&gt;&
quot;;
>
> &gt;&gt;echo
> "ORACLE_HOME=".getenv("ORACLE_HOME")."&lt;BR&gt;&
quot;;
>
> &gt;&gt;echo
> "TNS_ADMIN=".getenv("TNS_ADMIN")."&lt;BR&gt;"
;;
>
> &gt;&gt;echo
> "NLS_LANG=".getenv("NLS_LANG").".&lt;br&gt;"
;
> &gt;&gt;
> &gt;&gt;# this allows a successful connection
> &gt;&gt;
> &gt;&gt;$db = "  (DESCRIPTION =
> &gt;&gt;  (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521))
> &gt;&gt;  (CONNECT_DATA= (SID = testdb))
> &gt;&gt;  )";
> &gt;&gt;
> &gt;&gt;// these don't work.. php can't seem to find tnsnames.ora
> &gt;&gt;# $db = "testdb.boo.com";
> &gt;&gt;//$db = "testdb.boo.com";
> &gt;&gt;# $db = "testdb";
> &gt;&gt;//echo $testdb;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;$odbc = OCILogon("test/test","test",$db);
> &gt;&gt;
> &gt;&gt;if ($odbc == false){
> &gt;&gt;   $msg = OCIError($odbc)."&lt;BR&gt;";
> &gt;&gt;} else {
> &gt;&gt;echo "success!!!&lt;br&gt;";
> &gt;&gt;}
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;
> &gt;&gt;My problem is is that when I try to use the database alias in
> &gt;&gt;tnsnames.ora I
> &gt;&gt;get an ora-12154 error. I get this despite the facts that
> &gt;&gt;oracle_home,
> &gt;&gt;tns_admin and everything else is defined in the script and the
> &gt;&gt;tnsnames.ora
> &gt;&gt;contains exactly the same alias as I use in the hardcoded version
> &gt;&gt;(see the
> &gt;&gt;uncommented $db above).
> &gt;&gt;sqlnet.ora contains a value name_domain that apparently is appende
d
> &gt;&gt;to the
> &gt;&gt;alias in tnsnames.ora but accounting for this still doesn't let me
> &gt;&gt;connect
> &gt;&gt;to oracle . It's as if tnsnames.ora cannot be found. I've changed
> &gt;&gt;the
> &gt;&gt;permissions to 777 for the whole directory structure and I can
> &gt;&gt;successfully
> &gt;&gt;use tnsnames.ora with sqlplus or tnsping.
> &gt;&gt;
> &gt;&gt;Does anybody have any ideas what is going wrong? Is this a bug?
> &gt;&gt;
> &gt;&gt;thanks,
> &gt;&gt;
> &gt;&gt;neil
> &gt;&gt;

Report this thread to moderator Post Follow-up to this message
Old Post
Christopher Jones
04-27-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:31 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.