On Fri, 10 Jan 2003 11:57:41 -0500 Robert Hansen <[EMAIL PROTECTED]> wrote:

> I've been experimenting with your idea here and have run into another
> snag.
> 
> The connection to the 9i database works fine setting the Oracle home to the
> one DBD was compiled against (8.1.7) using the following method of connecting:
> $dbh = DBI->connect("dbi:Oracle:$db", $DBUser, $DBPwd, {PrintError => 0,
> AutoCommit => 0});
> 
> ...however, when I attempt to use this method (using and op$ account) it
> fails with an ora-27101: shared memory realm...
> 
> $dbh = DBI->connect("dbi:Oracle:", "/", "" , {PrintError => 0, AutoCommit
> => 0});
> 
> We change passwords often so this is the certainly the preferred method.
> 
> Any ideas?

If I recall the situation, you are depending on $ORACLE_SID to select
the appropriate instance and are using oraenv to set it along with
$ORACLE_HOME.  You have to use $ORACLE_SID because '/' is allowed for
OPS$ logins using local connections, not SQL*Net ones.  That
restriction can be disabled, but that is generally not a good idea.

I've been pondering this and the best I can come up with is to build
DBD::Oracle twice into separate directories using PREFIX= as an option
(e.g., 'perl Makefile.PL PREFIX=/app/DBD-Oracle/8i').  Then adjust
$PERL5LIB before starting your script so the appropriate version of
DBD::Oracle is in @INC.  Note that neither version gets installed in
the normal location.

If you are using bash or ksh, a function could be defined to change
$PERL5LIB.  For other shells, a script meant to be called inside ``
could write the revised $PERL5LIB to stdout.

 # untested
 fix_perl5lib () {
    if [ -z "$1" ]; then ver="9i"; else ver="$1"; fi
    case "${PERL5LIB:=''}"
       */app/DBD-Oracle/*)
           PERL5LIB=`echo "$PERL5LIB" | sed -e \
              "s,/app/DBD-Oracle/[^:]*,/app/DBD-Oracle/$ver,"`
       '') PERL5LIB="/app/DBD-Oracle/$ver"
       *)  PERL5LIB="/app/DBD-Oracle/$ver:$PERL5LIB"
    esac
    export PERL5LIB
 }
-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to