Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This might be a real simple question, but how do I print my oracle environment variables. I'm trying to connect a perl/cgi script to an oracle database, but I need to pass the correct environment variables to apache...Please help if you can

Replies are listed 'Best First'.
Re: oracle environment variables
by krujos (Curate) on Jan 07, 2003 at 15:55 UTC
     print `env`; will print the environment variables.
    If I recall correctly oracle docs will show you exactly how to connect.
    Good luck
    Josh
Re: oracle environment variables
by vek (Prior) on Jan 07, 2003 at 16:57 UTC
    First of all, find out what the correct environment variables should be. If you can connect to Oracle via sqlplus then chances are you have the correct variables. So, a quick env | grep ORACLE on the command line should give you what you need.

    Add those variables to your CGI prog:
    $ENV{ORACLE_HOME} = "/path-to/oracle-home"; # etc...
    -- vek --
Re: oracle environment variables
by jpfarmer (Pilgrim) on Jan 07, 2003 at 16:25 UTC
    You can use $ENV{'name'} to pull any environmental variable, but be aware that you can't completely trust the environmental variables. ALWAYS check to make sure they contain the type of information you expect them to have BEFORE using them and be sure to run in taint mode if you arn't already.
Re: oracle environment variables
by osama (Scribe) on Jan 08, 2003 at 04:10 UTC
    I find that
    $ENV{ORACLE_HOME}='/oracle/';
    $ENV{ORACLE_SID}='ORCL';
    
    works perfectly for me!