RES: [PHP-DB] Problems with Oracle connections
| From: | Carlos Correa Goncalves | Date: | Thu, 29 Mar 2001 14:47:44 +0000 |
| Subject: | RES: [PHP-DB] Problems with Oracle connections | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7986@lists.php.net to get a copy of this message | ||
Hi,
Use the OCI functions (see the html help) with the TNS like it is in your
tnsnames.ora file (C:\ORAWIN\NETWORK\ADMIN\TNSNAMES.ORA):
<?php
putenv("ORACLE_SID=java");
putenv("ORACLE_HOME=C:\ORAWIN");
$tns = "(DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =
oracleserver)(PORT = 1521)))
(CONNECT_DATA = (SID = java) ) )";
$Conn=OCIPLogon("user","password",$tns) or die("Can not connect to
Oracle");
?>
Bye
Carlos
> ----- Mensagem original -----
> De: bgadelha [SMTP:bgadelha@bol.com.br]
> Enviada em: Quinta-feira, 29 de Março de 2001 10:37
> Para: php-db@lists.php.net
> Assunto: [PHP-DB] Problems with Oracle connections
>
> Hi,
> I'm having troubles using PHP+Oracle.
> I´m under Win98, with Apache WebServer, PHP4 and Oracle.
> When I try to connect, the following error message is
> displayed:
>
> Warning: Unable to connect to ORACLE (ORA-12154:
> TNS:could not resolve service name) in
> c:\apache\htdocs\testeoracle.php on line 24
> falhou outra vez:ORA-12154: TNS:could not resolve
> service name
>
> Here is my code:
>
> <?php
>
> if(ora_plogon("rascunho@dvfpmm","java"))
> { echo "conectou"; }
> else
> { echo "falhou outra vez:".ora_error(); }
>
> phpinfo(INFO_ENVIRONMENT);
>
> ?>
>
> Can somebody help me?
>
> Thanks
> Bruno.
>
>
> __________________________________________________________________________
> O BOL é Top3 no iBest! Vote já para torná-lo Top1!
> http://www.bol.com.br/ibest.html
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net