I want start application like this
C:\>set nls_lang=...
C:\>MyApp.exe
At now moment application start with NLS_LANG in registry, how I can check current NLS_LANG on registry tools from ODAC for given OracleHome?
I want compare NLS_LANG from environment variable and NLS_LANG from registry from selected OracleHome and if they different then send alter session command (after session connected).
start application with nls_lang environment variable
Re: start application with nls_lang environment variable
Hello,
The information about Oracle clients is located in the HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ registry branch. To define the NLS_LANG variable value, you can use the TRegistry class, the current Home can be retrieved from the OracleHomes array using the OraSession1.Home property
The information about Oracle clients is located in the HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ registry branch. To define the NLS_LANG variable value, you can use the TRegistry class, the current Home can be retrieved from the OracleHomes array using the OraSession1.Home property
Code: Select all
uses ... , Registry, OraCall;
....
var
pReg: TRegistry;
begin
pReg := TRegistry.Create(KEY_READ);
try
pReg.RootKey := HKEY_LOCAL_MACHINE;
if pReg.OpenKey('\SOFTWARE\Oracle\' + OracleHomes[Integer(OraSession1.Home) - 1].Key, False) then
if pReg.ReadString('NLS_LANG') <> GetEnvironmentVariable('NLS_LANG') then
ShowMessage('do something');
finally
pReg.Free;
end;
end;