/    Sign up×
Community /Pin to ProfileBookmark

Connect to a remote Oracle BD

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.

[code=php]
<?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);
}
}
?>
[/code]

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.

[code=php]
require_once(‘conexion.php’);
$miconexion = new Db(“siges@prueba”,”siges”) ;
$qid = $miconexion->consulta(select * from table);
[/code]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@chazzyApr 23.2008 — you probably should use this line, but change table to the table you want

[code=php]$qid = $miconexion->consulta("select * from table"); [/code]

But is there an actual error you're getting?
Copy linkTweet thisAlerts:
@r4gn0authorApr 23.2008 — 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
Copy linkTweet thisAlerts:
@chazzyApr 24.2008 — i understood that, but do you get an error message or anything?
×

Success!

Help @r4gn0 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...