Jump to content

Archived

This topic is now archived and is closed to further replies.

diskhub

ocilogon() [function.ocilogon]: _oci_open_server: ORA-12154:

Recommended Posts

Hi following is my code:

$conn = ocilogon('scott', 'tiger', 'customers');

$sql = "SELECT * from customers";
$q = ociparse($conn, $sql);
$results = ociexecute($q); 

 

however, when ever i execute it in PHP5.0,

it gives me this error:

 

PHP Warning: ocilogon() [function.ocilogon]: _oci_open_server: ORA-12154: TNS:could not resolve the connect identifier specified in c:\Inetpub\wwwroot\orcl_test.php on line 13 PHP Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in c:\Inetpub\wwwroot\orcl_test.php on line 16 PHP Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in c:\Inetpub\wwwroot\orcl_test.php on line 17 

Share this post


Link to post
Share on other sites

I've seen your error in my setup (IIS6/PHP5) whenever I've had the following problems in tnsnames.ora.

 

verify tnsnames.ora

-- path set in System Environment variables?

-- sytax (unmatched brackets?)

-- valid net service name

 

I found answers [a href=\"http://ora-12154.ora-code.com/\" target=\"_blank\"]here[/a].

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

I'm having the same issue. I have tried alot everything I can find on the internet. I have set TNS_ADMIN in my environment variables. I keep getting the same error also:

 

Warning: ocilogon() [function.ocilogon]: _oci_open_server: ORA-12154: TNS:could not resolve the connect identifier specified in c:\Inetpub\wwwroot\index.php on line 2

 

My code looks like this:

 

<?

if ($c = OCILogon("sys","lizzie","TEST"))

{

echo "Connection to database successfull!";

OCILogOff($c);

}

else

{

$err = OCIError();

echo $err['message'];

}

?>

 

Can someone provide a step by step guide that will help alot of us out.

 

I'm running:

 

Windows XP Professional w/ SP2

Oracle 9i Database Release 2 Enterprise

PHP 5.0.4

IIS 5

 

Thanks in advanced

 

(V)ega

Share this post


Link to post
Share on other sites
try this format 4 the OCI conn

$conn = OCILogon("hr", "hr_password", '//mymachine.mydomain:port/MYDB);

eg:

$conn = OCILogon("Test", "TestPW", '//10.132.1.12:1021/LIMSLIVE);

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.