On Thu, 16 Jan 2003 10:11:02 -0500 Robert Hansen <[EMAIL PROTECTED]> wrote:

> I really appreciate your suggestion.  However, even with this approach we
> would be using one version or the other in a given script.  We currently
> cycle through each database on a given server (regardless of the Oracle
> version) from each of our monitoring scripts.  I wouldn't want to have to
> schedule 2 sets of monitoring scripts (one for 8i instances and one for 9i
> instances).  It's not looking like there is a clean, simple way of doing
> this now, but it is my hope that this be considered in later releases of
> DBD-Oracle.  One thought is to create different drivers (not sure what's
> involved) and thereby allowing the version selection in the DBI->connect
> statement.

My intent and hope was to keep the Oracle version specifics out of the
Perl script.  You have to set ORACLE_HOME differently anyway, the same
shell script that does that could also set PERL5LIB, DBD_LIB, or
ORACLE_VER to whatever is needed so the begin block I suggested would
find the right DBD::Oracle.

It's not as clean as I'd like, but if you have to use OPS$, something
else has to give.

You replied to Kristian's suggestion, not my reply or re-reply.  I've
repeated parts of my second message below.

>> A variation on the above would allow you to use the desired
>> DBD::Oracle without having to put the directory in $PERL5LIB and
>> without hardcoding the directory in a script.
>> 
>> Create a symlink to the appropriate directory in a known location
>> relative to $ORACLE_HOME in each instance.  Setting a specific
>> environment variable might also be an option.

# Untested
>> BEGIN {
>>    my $DBD_LIB     = $ENV{DBD_LIB};
>>    my $ORACLE_HOME = $ENV{ORACLE_HOME};
>>    my $ORACLE_VER  = $ENV{ORACLE_VER};
>>    if    ( defined $DBD_LIB ) {}   # Envvar takes precedence
>>    elsif ( defined $ORACLE_HOME && -d "$ORACLE_HOME/DBD-Oracle" ) {
>>       $DBD_LIB = "$ORACLE_HOME/DBD-Oracle";
>>    }
>>    elsif ( defined $ORACLE_VER && length $ORACLE_VER ) {
>>       $DBD_LIB = "/app/DBD-Oracle/$ORACLE_VER";
>>       die "Invalid \$ORACLE_VER: $ORACLE_VER" if ! -d $DBD_LIB;
>>    }
>>    # Add other likely locations, if desired
>>
>>    # Not using 'use lib', $DBD_LIB might legitimately not be set
>>    if ( defined $DBD_LIB && length $DBD_LIB ) {
>>       die "Not a directory: '$DBD_LIB'\n" if ! -d $DBD_LIB;
>>       unshift @INC, $DBD_LIB;
>>    }
>> }
>> use DBI; # DBD::Oracle is require()d by DBI->connect()

-- 
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