Page 1 of 1
Registry TNS_ADMIN settings
Posted: Tue 12 Oct 2010 11:23
by MarkF
It appears that the OraServerEnum.GetTNSFileName function doesn't check HKLM\Software\Oracle\[TNS_ADMIN] for a value. I believe that it should do this if it doesn't find this value in any of the home registry locations. The Oracle Client checks this location and uses it (it's common when using Instant Client to put it there if you don't want to use an environment variable for TNS_ADMIN.) Also this function should set Result := '' at the top to avoid the result returning the passed in value if no value is found (the old result is a hidden var argument issue.)
Thanks!
Posted: Tue 12 Oct 2010 12:14
by AlexP
Hello,
The GetTNSFileName function returns the correct value from registry HKLM\Software\Oracle\[TNS_ADMIN], check that you added the correct value to the registry key HKLM\Software\Oracle\[ORACLE_HOME].
Posted: Tue 12 Oct 2010 13:48
by MarkF
Hi Alex,
It checks the individual registry home locations if they exist, but it does not appear to check the root location. The Oracle Client does check this location, so ODAC should as well. I've modified the code to do it, you just need to add
Code: Select all
// Added check for tns_admin in the HKLM\software\Oracle
if FileName = '' then
FileName := AddPath(RegIniFile.ReadString(sOraHomeKey, sTnsAdmin, ''), sTnsNames);
Right under the if-else clause where it checks the individual homes. Thanks.
-Mark
Posted: Fri 15 Oct 2010 13:19
by AlexP
Hello,
Thank you for the information.
We added search for the TNS_ADMIN variable in the oracle root location.
Posted: Thu 09 Dec 2010 14:36
by MarkF
Hi Alex,
The code for this in the latest build doesn't actually work. It is:
Code: Select all
if FileName = sTnsNames then
FileName := AddPath(RegIniFile.ReadString(sOraHomeKey, sTnsAdmin, ''), sTnsNames);
However Filename will actually be empty there if it hasn't been found yet. The code needs to be:
Code: Select all
if FileName = '' then
FileName := AddPath(RegIniFile.ReadString(sOraHomeKey, sTnsAdmin, ''), sTnsNames);
Thanks,
-Mark
Posted: Mon 13 Dec 2010 09:26
by AlexP
Hello,
The FileName variable is can be empty only if the ORACLE_HOME registry value is not set, so we will add the following check:
if (FileName = sTnsNames) OR (FileName = '') then
Posted: Mon 13 Dec 2010 12:50
by MarkF
Excellent! Thanks.
-Mark