ID:               36649
 User updated by:  madlybad at hotmail dot com
 Reported By:      madlybad at hotmail dot com
-Status:           Bogus
+Status:           Closed
 Bug Type:         OCI8 related
 Operating System: Windows XP Pro SP2
 PHP Version:      5.1.2
 New Comment:

Using this code I fixed the problem:

         $db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
                      (HOST = host.com)(PORT=1521))
                      (CONNECT_DATA=(SERVER=DEDICATED)
                      (SERVICE_NAME=MYDB)))";

  $conexion = oci_pconnect("user","password",$db);

But I have to use oci_pconnect() and not oci_connect. If I used
oci_connect(), PHP CGI crash. I would like to know why. Or maybe open a
new Bug about this. Please let me know is I should open it.


Previous Comments:
------------------------------------------------------------------------

[2006-03-08 08:23:28] [EMAIL PROTECTED]

The error you get comes from Oracle client libs -> not PHP problem.

------------------------------------------------------------------------

[2006-03-08 07:23:48] cjbj at hotmail dot com

The bug system is not the best place to ask this question.

Refer to notes like
http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html
and check all your environment variables - e.g. ORACLE_HOME - are set
correctly in the shell environment that starts the web server.

------------------------------------------------------------------------

[2006-03-07 22:36:04] madlybad at hotmail dot com

Description:
------------
My configuration to connect to Oracle 9i is correct. I am able to
connect to Oracle 9i using SQLPLus and TOAD. But using PHP I am unable
to connect to Oracle this error appears "ORA-12154: TNS:could not
resolve the connect identifier specified".

Reproduce code:
---------------
<?php

  $conexion = oci_pconnect('TIENDAS','tiendas','DAVID');//('hr', 'hr',
'orcl');
  if (!$conexion) {
    $e = oci_error();
    echo "Error al Conectarse";
    print htmlentities($e['message']);
    exit;
  }

  $consulta = 'SELECT * FROM promotoras_tda';

  $id_sentencia = oci_parse($conexion, $consulta);
  if (!$id_sentencia) {
    $e = oci_error($conexion);
    echo "Error al Parsear";
    print htmlentities($e['message']);
    exit;
  }

  $r = oci_execute($id_sentencia, OCI_DEFAULT);
  if (!$r) {
    $e = oci_error($id_sentencia);
    echo "Error al Ejecutar la Conuslta";
    echo htmlentities($e['message']);
    exit;
  }

  print '<table border="1">';
  while ($fila = oci_fetch_array($id_sentencia, OCI_RETURN_NULLS)) {
    print '<tr>';
       foreach ($fila as $item) {
         print '<td>'.($item?htmlentities($item):'&nbsp;').'</td>';
       }
       print '</tr>';
  }
  print '</table>';

  oci_close($conexion);
?> 

Expected result:
----------------
connected!

Actual result:
--------------
ORA-12154: TNS:could not resolve the connect identifier specified


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36649&edit=1

Reply via email to