This was noticed in some legacy Java application (jre1.4 on HP-UX).
Parent process (shell script S1) is starting Java process, which on its own is starting child process (shell script S2). Schematically it's: . 。
Java application connects to Oracle DB using OCI driver.
What is strange here is that process running S1 has environment variable NLS_LANG
set to american_america.BLT8MSWIN1257
, Java spawns S2 using:
Runtime.getRuntime().exec(cmd);
and S2 shows that NLS_LANG
is set to american_america.UTF8
This happens on some limited-access environment (production), I was not able to reproduce same problem on linux with jre 1.5.
AFAIK, Java process should inherit environment from its parrent (S1) and should pass all environment variables to its child S2 (since single argument exec
call was used). However, it does not seem to be the case. Any ideas why NLS_LANG
appears to be altered?
Are there any logon triggers in the system? It's very common to set a lot of environment variables (generally, NLS_*_FORMAT) in logon triggers to not rely on environment configuration for system behavior.
SELECT * FROM DBA_TRIGGERS
WHERE TRIGGERING_EVENT = 'LOGON';
Since NLS_LANG is exported by the parent, I'll assume it is being inherited by the child. In which case you are looking for some startup script is firing somewhere that is overwriting it with american_america.UTF8. I'd look for a .cshrc (or similar, depending on what shell S2 is). Might be in the user's area or an /etc global area.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.