title: Perl script cannot connect to Oracle from linux shell with error and code
body: <p>I need some help in determining the problem with my connection from a perl file to a DB.</p>
  
  <p>The code runs and executes fine when it is run from the web (browser to /file.pl url). </p>
  
  <p>In a shell context (putty), when I run the script "perl /file.pl", I get this error: </p>
  
  <pre><code>[date] file.pl: DBI connect('address','username', 'password') failed: 
  ERROR OCIEnvNlsCreate (check OR ACLE_HOME and NLS settings etc.) at file.pl line 61
  </code></pre>
  
  <p>Line 61 reads: </p>
  
  <pre><code>$dbh = DBI-&gt;connect(A, B, C );
  </code></pre>
  
  <p>More details: When another user (with presumably more permissions) runs the file, it works for him (in the shell).</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  require 'include.pl';
  require 'bencfg.pl';
  use lib '/www/modules/'; #rqd
  use DBI;
  use DBD::Oracle;
  
  print "Content-type: text/html; charset=UTF-8\n\n";
  print "Test Run of connection...\n\n&lt;br&gt;";
  print "ORA_HOME: '$ENV{ORACLE_HOME}'\n&lt;br&gt;";  #ORA_HOME: '/opt/oracle/10g/'
  
  #connect to DB
  $dbh = DBI-&gt;connect(A, B C) || die "Database connection not made: $DBI::errstr";
  if($dbh){
     print "OK\n&lt;br&gt;";
     $dbh-&gt;disconnect;
  }
  else{
     print "failed: $DBI::errstr\n";
   }
  </code></pre>
  
  <p>I know the variables of DBI->connect work. Thats not the issue. I believe its permissions but I cant tell how to fix it.</p>
  
  <p>Some additional info:
  ORA_HOME: '/opt/oracle/10g' </p>
  
  <pre><code>NLS_SESSION_PARAMETERS
  
      PARAMETER   VALUE
      NLS_LANGUAGE    AMERICAN
      NLS_TERRITORY   AMERICA
      NLS_CURRENCY    $
      NLS_ISO_CURRENCY    AMERICA
      NLS_NUMERIC_CHARACTERS  .,
      NLS_CALENDAR    GREGORIAN
      NLS_DATE_FORMAT MM/DD/YYYY HH24:MI:SS
      NLS_DATE_LANGUAGE   AMERICAN
      NLS_SORT    BINARY
      NLS_TIME_FORMAT HH.MI.SSXFF AM
      NLS_TIMESTAMP_FORMAT    DD-MON-RR HH.MI.SSXFF AM
      NLS_TIME_TZ_FORMAT  HH.MI.SSXFF AM TZR
  NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
  NLS_DUAL_CURRENCY   $
  NLS_COMP    BINARY
  NLS_LENGTH_SEMANTICS    BYTE
  NLS_NCHAR_CONV_EXCP FALSE
  </code></pre>