![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
05/06/2012, 13:16
|
![Avatar de manuel2011](http://static.forosdelweb.com/customavatars/avatar457187_2.gif) | | | Fecha de Ingreso: marzo-2012 Ubicación: Cuautla, Morelos
Mensajes: 31
Antigüedad: 12 años, 11 meses Puntos: 1 | |
Respuesta: Conectar Php y Oracle que esta en otra Pc? Yo utilice este:
//oracle connection variables
$ora_user = 'system'; //username
$ora_pass = 'adm'; //user password
$ora_host = '10.201.4.100'; //host name or server ip address
$ora_db = 'ora0'; //database name
$ora_host='(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 10.201.3.158)
(PORT = 1521)
)
(CONNECT_DATA =(SID = ora0))
)'; //tnsnames like
$conn = oci_connect($ora_user,$ora_pass,$ora_host);
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT * FROM clientes');
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
Espero te sirva.. Saludos |