Hello
We are using GetServerList to get a list of alias before connecting an TOraSession.
We have Oracle 10g,9,8 and 7 clients installed on the same machine.
In the registry the key Software\Oracle\Key_OraClient10g exists with a string value TNS_ADMIN which points to the centralised directory where the tns_names file exists.
The path for the oracle client is at the start of the path environemnt variable.
In the Odac help it is stated : "If HomeName property is set to '', ODAC uses first directory from the list of homes encountered in environment PATH variable as default Oracle home. "
In other words we would like to use the file specified by the tns_admin registry key in the oracle 10g home.
If the TNS_ADMIN environment variable does not exist ODAC uses the following code to try and find the registry key :
if AnsiCompareText(OracleHomeNames , OracleHomeName) = 0 then begin
FileName := AddPath(RegIniFile.ReadString(sOraHomeKey +
OracleHomeKeys, sTnsAdmin, ''), sTnsNames);
However in our case the OracleHomeName is empty and ODAC, as it can't find the registry key, looks for the tns_names file on the workstation.
What we have done to get around this "problem" is to use the following code when the OracleHomeName is empty :
if AnsiCompareText(OracleHomePaths , OracleHomePath) = 0 then
begin
FileName := AddPath(RegIniFile.ReadString(sOraHomeKey +
OracleHomeKeys, sTnsAdmin, ''), sTnsNames);
In other words we use the OracleHomePath instead of the OracleHomeName.
Is there a better way of doing this ?
Best Reagrds
Paul
MitSA
Finding the TNS_NAMES.ora
I have another problem with ODAC and Oracle registry.
I'm using version 4.5 of ODAC. And on some machines with Oracle 8 client in HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE I dont have ORACLE_HOME key. Instead of it there are some subdirectories like ALL_HOMES, HOME1, HOME2 where are proper paths to tsnnames direcotry. To make it work properly, on every machine I had to create a new key ORACLE_HOME with proper path.
I need it because I also use GetServerList method.
And my question is.
Have you resolved it in future releases?
Or is there any other workaround than adding the key?
I'm using version 4.5 of ODAC. And on some machines with Oracle 8 client in HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE I dont have ORACLE_HOME key. Instead of it there are some subdirectories like ALL_HOMES, HOME1, HOME2 where are proper paths to tsnnames direcotry. To make it work properly, on every machine I had to create a new key ORACLE_HOME with proper path.
I need it because I also use GetServerList method.
And my question is.
Have you resolved it in future releases?
Or is there any other workaround than adding the key?