I have the following problem: I currently connect to one of our Linux servers using PuTTY on my Windows 10 machine. If I use a ‘standard’ PuTTY connection I have no problem: I can log in and run my Perl script to access an Oracle database on the Linux server. However, recently I have set up a new PuTTY connection (I copied the original working copy used above). The only difference from the original is that I have entered the following in the section ‘Connection->SSH->Remote command’ of the PuTTY configuration window:

cd ../home/code/project1/scripts/perl ; /bin/bash

(I have done this so I arrive directly in the folder containing all my scripts.)

I can still log into the server with no problems and it takes me straight to the folder that contains my Perl scripts. However, when I run the script to access the Oracle database I get the following error:

DBI connect('server1/dbname','username',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var  or PATH (Windows) and or NLS settings, permissions, etc. at PerlDBFile1.pl line 10.
impossible de se connecter à server1 / dbname at PerlDBFile1.pl line 10, <DATA> line 1.

In addition, if I run the 'env' command on the server the variable $ORACLE_HOME is not listed (If I run the same 'env' command on the server with the standard PuTTY connection the $ORACLE_HOME variable is present.)

Just to note: Running any other Perl script on the server (that does NOT access the Oracle database) through either of the PuTTY sessions I have created works with no problems.

  • Have you tried cd ../home/code/project1/scripts/perl ; /bin/bash -i ? You might just miss your and the system's .profile – Eugen Rieck Jul 19 '17 at 7:54
  • Many thanks Eugen for the quick response, unfortunately your suggestion results in the same error message. – gauss76 Jul 19 '17 at 7:59
  • please do a grep 'ORACLE_HOME' ~/* /etc/bach* /etc/profile* (ignoring the "is a directory" errors) and post the result. – Eugen Rieck Jul 19 '17 at 8:06
  • If I run the suggested command on both of the PuTTY connections I get exactly the same output. The only entry that does not finish with "is a directory" is: grep: /etc/bach*: No file or directory of this type – gauss76 Jul 19 '17 at 8:17
  • Sorry, this was a typo: /etc/bash* – Eugen Rieck Jul 19 '17 at 8:39

OK, I have the solution!...Thanks to everyone who replied.

Basically, I originally had the command:

cd ../home/code/project1/scripts/perl ; /bin/bash (See original post)

To get it to work I replaced the above with

cd ../home/code/project1/scripts/perl; source ~/.bash_profile; /bin/bash

I also tried:

cd ../home/code/project1/scripts/perl; /bin/bash; source ~/.bash_profile

But that did NOT work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.