Click to See Complete Forum and Search --> : Connect to a remote Oracle BD


r4gn0
04-23-2008, 05:10 PM
Hi!! how can i connect to a remote oracle bd that its in my network? i can connect with Toad, by cmd with sqlplus, but i cant connect with php :(
how can i do it??
im using a connection class that works when i upload files in localhost, but when i test files in my pc it doesnt.


<?php
class Db
{
var $db_USER = "";
var $db_PASS = "";
var $base = "";
var $dbc = 0;
var $cur;

function Db($user, $pass)
{
$this->db_USER = $user;
$this->db_PASS = $pass;
$this->dbc = ora_logon($this->db_USER,$this->db_PASS);
$cur=ora_open($this->dbc);
}
function consulta($sql="")
{
$cur=ora_open($this->dbc);
$parse = ora_parse($cur,$sql);
$result = ora_exec($cur);
return($result);
}
function close_db()
{
ora_close($this->dbc);
}
}
?>

It works for the connection, if you see there is something wrong in the file, please let me know...this is the instruction to connect from the php that includes the file.


require_once('conexion.php');
$miconexion = new Db("siges@prueba","siges") ;
$qid = $miconexion->consulta(select * from table);

chazzy
04-23-2008, 05:17 PM
you probably should use this line, but change table to the table you want

$qid = $miconexion->consulta("select * from table");

But is there an actual error you're getting?

r4gn0
04-23-2008, 05:21 PM
i posted that line as an example, that isnt the actual query, my problem is that i cant connect to the oracle DB that is on my server, i can connect trought TOAD and CMD with sqlplus

chazzy
04-23-2008, 07:47 PM
i understood that, but do you get an error message or anything?