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.


No good deed goes unpunished. -- (attributed to) Oscar Wilde

Replies are listed 'Best First'.
Re^2: Problem in connecting to Oracle with /
by rampec (Initiate) on Dec 23, 2005 at 05:49 UTC

    Hi,

    Thanks for your suggestion

    My problem is I need to connect to oracle DB with / from unix box. It should take the unix login account.

    Thanks

    Ram