Re: Connecting to Oracle through Perl.

2002-09-19 Thread Tim Bunce

But beware that setting ORACLE_HOME to a different version to the one
that's supplying the Oracle client library (via LD_LIBRARY_PATH etc)
is likely to cause problems, like not being able to get the text of an
error message, or worse.

Tim.

On Wed, Sep 18, 2002 at 01:28:20PM -0400, [EMAIL PROTECTED] wrote:
> 
> 
> -- Ellen Yu <[EMAIL PROTECTED]> on 09/18/02 09:59:41 -0700
> 
> > A related question:
> > 
> > Is there anyway to "hard code" the Oracle environment variables somewhere
> > in the perl directories such that if someone uses "/usr/bin/perl"  they
> > will automatically use a certain Oracle client directory.  My shop has
> > several client versions of Oracle and some of them would have to either
> > reset their environment variables or change their perl scripts.
> > 
> > I'm trying to think of a way where they don't have to do either,
> > preferably without multiple installations of perl.
> 
> Use a single module that checks the versions and exports
> an environment based on the internal logic. Locate the 
> module in separate perl installations and you'd have perl-
> specific settings; share them and you'd have oracle-specific
> settings.
> 
> Something like:
> 
> my %baseenv = 
> (
> foo => 'bar',
> ...
> 
> # constant between shells
> 
> HOME=> $ENV{HOME},
> TERM=> $ENV{TERM},
> ...
> );
> 
> if( (my $a = subcall_that_checks_oracle) eq '1.2.3.4' )
> {
> $baseenv{ORACLE_HOME} = 'whatever'
> }
> elsif( $a eq '4.3.2.1' )
> {
> $baseenv{ORACLE_HOME} = 'whatever-else';
> }
> 
> 
> 
> %ENV = %baseenv;
> 
> exit system( $ENV{SHELL} );
> 
> 
> 
> 
> --
> Steven Lembark  2930 W. Palmer
> Workhorse Computing  Chicago, IL 60647
>+1 800 762 1582



Re: Connecting to Oracle through Perl.

2002-09-18 Thread lembark



-- Ellen Yu <[EMAIL PROTECTED]> on 09/18/02 09:59:41 -0700

> A related question:
> 
> Is there anyway to "hard code" the Oracle environment variables somewhere
> in the perl directories such that if someone uses "/usr/bin/perl"  they
> will automatically use a certain Oracle client directory.  My shop has
> several client versions of Oracle and some of them would have to either
> reset their environment variables or change their perl scripts.
> 
> I'm trying to think of a way where they don't have to do either,
> preferably without multiple installations of perl.

Use a single module that checks the versions and exports
an environment based on the internal logic. Locate the 
module in separate perl installations and you'd have perl-
specific settings; share them and you'd have oracle-specific
settings.

Something like:

my %baseenv = 
(
foo => 'bar',
...

# constant between shells

HOME=> $ENV{HOME},
TERM=> $ENV{TERM},
...
);

if( (my $a = subcall_that_checks_oracle) eq '1.2.3.4' )
{
$baseenv{ORACLE_HOME} = 'whatever'
}
elsif( $a eq '4.3.2.1' )
{
$baseenv{ORACLE_HOME} = 'whatever-else';
}



%ENV = %baseenv;

exit system( $ENV{SHELL} );




--
Steven Lembark  2930 W. Palmer
Workhorse Computing  Chicago, IL 60647
   +1 800 762 1582



Re: Connecting to Oracle through Perl.

2002-09-18 Thread Ellen Yu

A related question:

Is there anyway to "hard code" the Oracle environment variables somewhere
in the perl directories such that if someone uses "/usr/bin/perl"  they
will automatically use a certain Oracle client directory.  My shop has
several client versions of Oracle and some of them would have to either
reset their environment variables or change their perl scripts.

I'm trying to think of a way where they don't have to do either,
preferably without multiple installations of perl.


Regards,

Ellen Yu




Re: Connecting to Oracle through Perl.

2002-09-18 Thread Tim Bunce

On Wed, Sep 18, 2002 at 06:54:13PM +0530, Sridhar Saragu wrote:
> Hi,
> 
> Can  somebody tell me  where the Perl  exactly  look for tnsnames.ora while
> connecting to Oracle ? (like home, oracle_home, tns_admin etc ...).  I want
> to
> 
> know the order in which it looks & the directories ?

To quote Star Wars: "Use the source, Luke"!

See load_dbnames() in Oracle.pm

Tim.



RE: Connecting to Oracle through Perl.

2002-09-18 Thread Fannin, David P.

The Oracle client looks for tnsnames.ora in the
$ORACLE_HOME/network/admin directory.  We typically set the Perl
variable $ENV{ORACLE_HOME} to the location of the Oracle installation in
our database connection modules prior to any attempt to open a database
connection.

-dpf-

---
David P. Fannin
Database Administrator  [EMAIL PROTECTED]
UM-Rolla Computing and Information Services  FAX (573) 341-4216
URL  http://www.umr.edu/~dpf   PHONE (573) 341-4841
---


-Original Message-
From: Sridhar Saragu [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 18, 2002 8:24 AM
To: [EMAIL PROTECTED]
Subject: Connecting to Oracle through Perl.


Hi,

Can  somebody tell me  where the Perl  exactly  look for tnsnames.ora
while connecting to Oracle ? (like home, oracle_home, tns_admin etc
).  I want to

know the order in which it looks & the directories ?

Thanks & Regards

Sridhar




Re: Connecting to Oracle through Perl.

2002-09-18 Thread Edd Dawson

on the Tru64 unix box we are using it is found at :

/usr/app/oracle/product/7.3.4/network/admin/tnsnames.ora

hope this helps

cheers
Edd

>>> "Sridhar Saragu" <[EMAIL PROTECTED]> 09/18/02 14:21 PM >>>
Hi,

Can  somebody tell me  where the Perl  exactly  look for tnsnames.ora while
connecting to Oracle ? (like home, oracle_home, tns_admin etc ...).  I want
to

know the order in which it looks & the directories ?

Thanks & Regards

Sridhar





RE: Connecting to Oracle through Perl.

2002-09-18 Thread NIPP, SCOTT V (SBCSI)

I am pretty sure this is supposed to reside in /etc.  I know that on
our HP-UX boxes the tnsnames.ora is in /etc and we use Perl for some
database access.

-Original Message-
From: Sridhar Saragu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 8:24 AM
To: [EMAIL PROTECTED]
Subject: Connecting to Oracle through Perl.


Hi,

Can  somebody tell me  where the Perl  exactly  look for tnsnames.ora while
connecting to Oracle ? (like home, oracle_home, tns_admin etc ...).  I want
to

know the order in which it looks & the directories ?

Thanks & Regards

Sridhar