Page 1 of 1

Login to Oracle server help needed

Posted: Wed May 29, 2002 8:37 am
by Broker
I meet problem with ORA-12154: TNS:could not resolve service name error and managed to solve it by using full SID info instead just SID ID.

But now, I get ORA-12699: Native service internal error. I have no problems accessing Oracle server by SQL Plus or Delphi.

I use PHP 4.0.4 and Oracle 8i for Windows. Can anyone helkp me sole this problem?

Code that gives me headdache is:



<?

$conn = OCILogon("sonja","info","(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = NST)(PORT = 1521)) ) (CONNECT_DATA = (SID = PG02)))");

?>

Posted: Thu May 30, 2002 1:21 pm
by mikeq
Hi,

You shouldn't have to use the full SID in the connect function.

Can you TNSPING the database from the command line?
Does your tnsnames.ora file have the correct entry?
Is PHP, Oracle Client, Oracle Server and Delphi all on the same machine?
Do you only have 8i client installed, or was 7.x installed previously on that machine?

Mike

Posted: Thu May 30, 2002 3:36 pm
by enygma
Here's the kind of thing I usually use:

$user="username";
$pass="password";
$string = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=6813))(CONNECT_DATA=(SID=SHOP)))";

$OC = OCILogon($user,$pass,$string);

Also, is it an Oracle 8 server you're accessing or lower?

btw:
ORA-12699: Native service internal error
Cause: An internal error occurred in the native services component.
Action: Enable tracing to determine the exact error. Contact Worldwide Customer Support.

Posted: Fri May 31, 2002 3:48 am
by Broker
Mike, I have to use full SID, there is some bug in widnows version of oci8 support, and it cannot read it form tnsnames.ora. I have Oracle 8i server installed on remote machine and my machine has Windows 2000, Oracle 8i client and Delphi. This is where I am trying to run PHP to connect Oracle server. I do not use web server but execute scripts from command prompt (i.e. php.exe script.php). There was no previous version of Oracle client here.


I have found some information about this problem and managed to avoid "ORA-12154: TNS:could not resolve service name error" and even "ORA-12699: Native service internal error" but now another one popped up: "ORA-12203: TNS:unable to connect to destination". Still, everything works when I use SQL Plus or Delphi.


Here is the code:

<?

PutEnv("ORACLE_HOME=c:\orant\ora80");
PutEnv("ORACLE_BASE=c:\orant");
PutEnv("ORACLE_SID=PG02.WORLD");
PutEnv("LD_LIBRARY_PATH=c:\orant\ora80\bin");
PutEnv("TNS_ADMIN=c:\orant\net80\admin");
PutEnv("TWO_TASK=c:\orant\net80\admin\tnsnames.ora");

$conn = OCILogon("sonja","info","(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.11)(PORT = 1521)) ) (CONNECT_DATA = (SID = PG02)))");

?>

As far as I can see, lots of people are dealing with the same problem for years, mostly without success.

Posted: Fri May 31, 2002 3:53 am
by Broker
Enigma, I tried your way, shortened SID but it gets worse: "ORA-12222: TNS:no such protocol adapter"

I changed above code to:

$conn = OCILogon("sonja","info","(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.11)(PORT=1521))(CONNECT_DATA=(SID=PG02)))");

Posted: Fri May 31, 2002 12:40 pm
by mikeq
Hi,

I happily have a server with PHP talking to a remote Oracle database, I only use the SID

e.g. OCILogon('blah','blah','SID');

I'm using the oci8 on windows without any errors, another thing to note is that I don't have to include any of those lines you have at the start

PutEnv("ORACLE_HOME=c:\orant\ora80");
PutEnv("ORACLE_BASE=c:\orant");
PutEnv("ORACLE_SID=PG02.WORLD");
PutEnv("LD_LIBRARY_PATH=c:\orant\ora80\bin");
PutEnv("TNS_ADMIN=c:\orant\net80\admin");
PutEnv("TWO_TASK=c:\orant\net80\admin\tnsnames.ora");

and it looks from this to be default install.

I didn't do any special configuration, just an out-the-box install of oracle client, uncommented the relevant extension in php.ini.

Have you tried it without any of the PutEnv stuff?

Mike

Posted: Sat Jun 01, 2002 5:04 am
by Broker
f course I did, I started that way but it was not working at all, then i started looking for help through net ant this is best I managed.

It seems there are two kind of usres of php/OCI8, ones who have no problems using it liek you, and ones who cannot make it work at all, like me. We have one comon thing, everything is installed in the same way by all of us. :(