Bill,
Wouldn't it be much simpler to create your own module to
determine the ORACLE_HOME to use based on the version
of Perl? ( or any other criteria )
Maintaining mods to DBI is probably not a business you want
to be in. Seems like a lot of work to go through each time
a new version of DBI/DBD::Oracle comes out.
Following is an example. Use something like this that won't
break with new versions of DBD::Oracle.
Jared
--------- WOH.pm
# Which Oracle Home?
package WOH;
use Config;
my $perlVersion = $Config{PERL_REVISION}
.$Config{PERL_VERSION}
.$Config{PERL_SUBVERSION};
# returns empty string if perl version unknown
sub getOracleHome {
my $self=shift;
my $ohome = '';
#$perlVersion = '564';
#print "Perl Version: $perlVersion\n";
if ( '560' eq $perlVersion ) {
$ohome = q{/u01/app/oracle/product/8.0.5};
} elsif ( '561' eq $perlVersion ) {
$ohome = q{/u01/app/oracle/product/8.1.5};
} elsif ( '562' eq $perlVersion ) {
$ohome = q{/u01/app/oracle/product/8.1.7};
}
return $ohome;
}
1;
------------ woh.pl
#!/usr/bin/perl
use warnings;
use lib './';
use WOH;
$ENV{ORACLE_HOME} = WOH->getOracleHome;
die "Oracle Home not set!\n" unless $ENV{ORACLE_HOME};
print "Oracle Home: $ENV{ORACLE_HOME}\n";
On Thursday 21 March 2002 17:16, William R Ward wrote:
> [EMAIL PROTECTED] (William R Ward) writes:
> > [EMAIL PROTECTED] (William R Ward) writes:
> > > Where I work we have a variety of versions of Oracle installed in
> > > various possible values of $ORACLE_HOME. It is necessary to have the
> > > environment variable $ORACLE_HOME match the version under which
> > > DBD::Oracle was compiled, in order for it to work. For example, if
> > > $ORACLE_HOME points to an 8.0.6 directory but DBD::Oracle was linked
> > > with 8.1.6, we get a rude segmentation fault.
> >
> > Let me clarify. We also have different versions of Perl, and each
> > one's DBI is linked against a different version of the Oracle client
> > libs. So it's hard to know for sure if you've got the right
> > $ORACLE_HOME.
>
> I figured out one way to do it:
>
> my $found;
> foreach my $dir (@INC) {
> my $file = "$dir/auto/DBD/Oracle/Oracle.so";
> next unless -r $file;
> $found = `strings $file` =~ /$ENV{ORACLE_HOME}/;
> last;
> }
> die "ORACLE_HOME ($ENV{ORACLE_HOME}) does not match DBD::Oracle\n"
> unless $found;
>
> However, my boss favors modifying DBD/Oracle.pm to include a die
> statement if the desired ORACLE_HOME is not found.
>
> Tim, any chance we could have some support for this type of error
> checking shipped with future versions of DBD::Oracle? Running strings
> on a binary is tacky, but if the MakeMaker values could be cached, it
> would be easy to do. It would of course be optional...
>
> --Bill.