rampec has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am getting the following error while connecting to Oracle with the defaulut user name ie /.

DBI connect('ST..','/',...) failed:

But I could be able to connect with regular user name like ram/ram.

This error is occuring in Perl5.8.4. In earlier versions, it is running fine.

Any help will be welcomed

Thanks,

Ram

Replies are listed 'Best First'.
Re: Problem in connecting to Oracle with /
by ptum (Priest) on Dec 22, 2005 at 14:19 UTC

    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

      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

Re: Problem in connecting to Oracle with /
by Anonymous Monk on Dec 22, 2005 at 11:54 UTC
    check log
    turn on debugging