Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

RE: Re: DBI, DBD::Oracle and LD_LIBRARY_PATH

by Shendal (Hermit)
on Aug 18, 2000 at 21:50 UTC ( [id://28549]=note: print w/replies, xml ) Need Help??


in reply to Re: DBI, DBD::Oracle and LD_LIBRARY_PATH
in thread DBI, DBD::Oracle and LD_LIBRARY_PATH

Yes, I am indeed running Solaris. Is it possible to do something like this then, in order for the script to retain control?
#!/app/eol/perl/bin/perl -- # -*-Perl-*- BEGIN { unless ($ENV{BEGIN_BLOCK_DONE}) { $ENV{ORACLE_HOME} = '/common/oracle/product/v8.1.6'; $ENV{LD_LIBRARY_PATH} = "$ENV{ORACLE_HOME}/lib"; $ENV{TNS_ADMIN} = '/common/oracle/env'; $ENV{BEGIN_BLOCK_DONE} = 1; exec $0 @ARGV; } } use DBI; $dbh = DBI->connect('','scmuser/scmuser@itopstst','','Oracle'); die $DBI::errstr unless defined $dbh;
I've never run an exec in a BEGIN block... I don't know what possible caveats there may be.

Thanks,
Shendal

Update: Well, I tried it and it still doesn't work. ARGH!

Replies are listed 'Best First'.
RE: RE: Re: DBI, DBD::Oracle and LD_LIBRARY_PATH
by lhoward (Vicar) on Aug 18, 2000 at 21:58 UTC
    The problem is even if you do it that way the linker already has LD_LIBRARY_PATH cached and you can't change it. The linker is started (and caches LD_LIBRARY_PATH) as soon as perl is started. You really need to set LD_LIBRARY_PATH before perl even starts. Other that just setting LD_LIBRARY_PATH in the environment the only solution I came up with was to set the environment, fork, and have the new process do the DB work. But that was kind of hokey and I didn't like spawning the second process to do the work. I tried to look for ways of chainging solaris's linker to not cache LD_LIBRARY_PATH but never got very far.

    BTW, LD_LIBRARY_PATH (and any other environmental vars used by the linker) are the only ones you need to worry about. You're OK setting other environmental vars (ORACLE_HOME, TNS_ADMIN, etc...) in your perl script. The problem is strictly related to the behavior of solaris's linker.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://28549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-03-28 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found