I am getting the following error connecting to an Oracle 11g database using a simple Perl script:
failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at
The script is as follows:
#!/usr/local/bin/perl
use strict;
use DBI;
if ($#ARGV < 3) {
print "Usage: perl testDbAccess.pl dataBaseUser dataBasePassword SID dataBasePort\n";
exit 0;
}
my ($user, $pwd, $sid, $port) = #ARGV;
my $host = `hostname`;
my $dbh;
my $sth;
my $dbname = "dbi:Oracle:HOST=$host;SID=$sid;PORT=$port";
openDbConnection();
closeDbConnection();
sub openDbConnection() {
$dbh = DBI->connect ($dbname, $user ,$pwd , { RaiseError => 1}) || die "Database connection not made: $DBI::errstr";
}
sub closeDbConnection() {
#$sth->finish();
$dbh->disconnect();
}
Anyone seen this problem before?
Check your Oracle client configuration (including, as the message says, ORACLE_HOME), check file permissions, etc. It's unlikely that DBI per se has anything to do with the problem, and I know for a fact that DBD::Oracle is compatible with the 11g libraries (at least the 11g InstantClient).
Install the perl module DBD::Oracle
Add use DBD::Oracle; into your perl script.
This made the problem go away for me.
Afther upgrade Oracle form 10.2.0.4 to 10.2.0.5 my Perl-CGI not working, the error.log file of Apache was the error:
DBI connect('DB','user',...) failed: ERROR OCIEnvNlsCreate. Check
ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings,
permissions, etc. at ...
OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows)
and or NLS settings, permissions, etc.! at ...
adding the following directive solve the problem:
my $ORACLE_HOME = "/usw/app/oracle/product/10.2";
$ENV{ORACLE_HOME}=$ORACLE_HOME;
Sorry for bringing this thread alive again, but I've been trying to solve this issue for weeks. Nowhere did I find that what finally solved it for me.
Environment: RedHat 6.5, Oracle Instant Client 12.1, Apache 2.2
What solved it for me:
Change the permissions of the directory where Oracle Instant Client is installed., which must also be the value of LD_LIBRARY_PATH. The directory wasn't accessible to "other", just owner and group. This command made the whole difference:
# chmod o+rx INSTANTCLIENT-DIRECTORY
I had been trying to create every possible combination of ORACLE_HOME and LD_LIBRARY_PATH. (Even "unsetting" ORACLE_HOME; I found suggestions that would solve the issue, since Instant Client needed only LD_LIBRARY_PATH and !NOT! ORACLE_HOME.) Nothing helped, until ...
it hit me to look further in the error message:
failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var
or PATH (Windows) and or NLS settings, permissions, etc.
permissions being the key word!
Hope this helps someone else!
2021 Update for CentOS 8 etc:-
If you use systemctl, nothing in your environment or Apache setup can pass environment vars to DBI!
you need to edit the /usr/lib/systemd/system/httpd.service file and add appropriate lines like this after the [Service] section:
[Service]
Environment=ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
Then re-start apache as usual:-
/bin/systemctl restart httpd.service
(Vote this up if it helped you: this web page is the #1 google result for this old problem which systemctl "security" has rebirthed)
Check the #!/usr/bin/perl (first line of your script) is the right perl version you wish to use too !
Previous answers don't solve this problem, but they did point me in the right direction: The launched environment was missing the DYLD_LIBRARY_PATH for Oracle instantclient. You can check by calling: launchctl export
or
launchctl getenv variable_name in OS X 10.10
I compared the output from my .bash_profile and found that the path to instanclient wasn't in launchctl PATH and DYLD_LIBRARY_PATH - Once I added them with the following it worked:
launchctl setenv PATH /path/to/instantclient
launchctl setenv DYLD_LIBRARY_PATH /path/to/instantclient
The environment variable used to specify the Oracle libraries may be different from one system to another. On most systems, use LD_LIBRARY_PATH but it may also be LIBPATH (notably on AIX), DYLD_LIBRARY_PATH, or maybe others.
I too went through the same issue. In my case ORACLE_HOME environment variable was incorrect.
I'm trying to install weblogic server on Centos 7 with following instruction of oracle about console mode. Everything will be fine till weblogic file 's extracting on my computer. I get this message about
display enviroment variable failed
I google it and found xming as solution. But is there any solution to install weblogic without xming.
You need to do a silent install as mentioned. You can find the documentation here.
Basically, you need two files:
A response file
Here, you will set some parameters like ORACLE_HOME, proxy information if needed and installation type, etc.
An oraInst.loc file
In this file, you need to do the following(from documentation):
Replace oui_inventory_directory with the full path to the directory where you want the installer to create the inventory directory. Then, replace oui_install_group with the name of the group whose members have write permissions to this directory.
After doing all of this, you can run the command as follows;
java -jar distribution_name.jar -silent -responseFile file [-options] [()*]
I uploaded my own oraInst.loc and response files here for demonstration. I strongly suggest you to read the documentation though. Good luck.
Running puppet on 64bit windows 2008 i have a service which looks like the following:
service{'Tomcat7':
ensure => running,
restart => 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file C:\tomcat7\bin\RestartService.ps1',
}
Running the command after restart in command prompt works
However:
When puppet triggers the refresh i get the following:
Debug: Executing 'c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file c:\tomcat7\bin\RestartService.ps1'
Error: /Stage[main]/Dep7transcription/Service[Tomcat7]: Failed to call refresh: CreateProcess() failed: The system cannot find the file specified.
Error: /Stage[main]/Dep7transcription/Service[Tomcat7]: CreateProcess() failed: The system cannot find the file specified.
Any help would be appreciated
Try changing the backslahses in forward slashes. Ruby internally uses the forward slash as path separator on all platforms.
If this comes up again this is related to inconsistent treatment of whitespace - arguments cannot be passed to the service restart command as of the puppet version up to date at time of asking
Is there a graphical tool (GUI) to execute ij 'describe' commands on Derby DB, outside the ij prompt?
I tried to use Netbeans, SQuirreL and DbVisualzer but it doesn't seem to help.
The error is always:
[Error Code: -1, SQL State: 42X01] Syntax error: Encountered "describe" at line 1, column 1.
For all tools.
Is ij the only way to execute this command?
Although you cannot execute describe in SQL, SQuirreL should be able to present just the same information for you (like this screenshot).
Is ij the only way to execute this command?
Yes, because it is not a SQL command but an ij command.
I have a working ANT build.xml that executes sqlplus to compile PL/SQL. I develop on MacOSX. My coworker is going to start contributing to the same application. He develops on WinXP. The sqlplus exec from ANT returns a TNS ORA-12560 error on WinXP. The identical build.xml works on MacOSX. The run string that ANT should be constructing on WinXP works in the DOS shell. We have set up the TNS_ADMIN environment variable in WinXP. What could I be missing?
I'm not sure from your description whether you're using the ANT SQL Task (http://ant.apache.org/manual/Tasks/sql.html) or if your using the exec task to call Sqlplus. Can you please clarify?
If you're calling sqlplus as an external command, you will be at the mercy of two main things:
a) environment variables
b) tnsnames.ora file
Windows and unix are different in how they handle specifying where you want to connect. In OSX you'll have the ORACLE_HOME and ORACLE_SID environment variables set. In Windows this would be in the registry. You may also have TNS_ADMIN set which determines where your tnsnames.ora file will be found.
First thing to check would be if you are both using the same tnsnames.ora file.
If you are, have both of you try to run tnsping to verify that the alias is configured properly.
Get back to us with the results of those tests.