in reply to Problem in connecting to Oracle with /
You can generally connect to a remote Oracle database in this manner:
sub db_connect_remote { my ($sid,$user,$password) = @_; my $oracle_home = 'location_of_oracle_on_your_system'; # /orasw/app/oracle/product/10.0.2 on my system $user = $user ? $user : 'some_default_value'; $password = $password ? $password : 'some_default_value'; $sid = $sid ? $sid : 'some_default_value'; unless (opendir(ORA_HOME,$oracle_home)) { print "Cannot locate ORACLE_HOME (expected $oracle_home)\n"; return 0; } $ENV{'ORACLE_HOME'} = $oracle_home; my $dbh = DBI->connect("dbi:Oracle:$sid", $user, $password, { RaiseError => 1, AutoCommit => 0 }) or die "Can't connect to Oracle $sid: $DBI::errstr"; return $dbh; }
Of course, this depends on an entry for that SID in your local tnsnames.ora file -- but basically, if you can log in via SQLNet from that host, you can probably log in via the DBI in this fashion.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem in connecting to Oracle with /
by rampec (Initiate) on Dec 23, 2005 at 05:49 UTC |