Hello,
The subject says it all. TOraServerEnumerator.GetServerList does not look for TNS_ADMIN environment variable.
Thanks
John
Bug: TOraServerEnumerator does not check TNS_ADMIN environment variable
Re: Bug: TOraServerEnumerator does not check TNS_ADMIN environment variable
Yes, the variable TNS_ADMIN is not referenced in TOraServerEnumerator.GetServerList, but is referenced earlier, in the TOracleHomes class in the OracleCall unit: procedure AddToOracleHomes(const Path, Key: string; ClientType: OralceClientType);
Re: Bug: TOraServerEnumerator does not check TNS_ADMIN environment variable
Well, when I tried it (using an instant client, so no network\admin folder in my oracle home), it didn't find my tnsnames file, which can only be found using the TNS_ADMIN environment variable.
My code is like this, (where cboDatabase is a TCombobox)
Is the code not intended to be used this way?
-John
My code is like this, (where cboDatabase is a TCombobox)
Code: Select all
var
Enum: TOraServerEnumerator;
begin
Enum := TOraServerEnumerator.Create;
try
Enum.GetServerList(cboDatabase.Items);
finally
Enum.Free;
end;
-John
Re: Bug: TOraServerEnumerator does not check TNS_ADMIN environment variable
Hi John!
Thanks for your reply.
The code you provided will return a list of TNS aliases for only one default ORACLE_HOME.
In this case, you can explicitly assign the default ORACLE_HOME. For example, if the Oracle InstantClient you installed is
located in the 'C:\OracleInstantClient' folder, and the TNS_ADMIN = C:\OracleInstantClient\NETWORK\ADMIN, you can change your code as follows:
Thanks for your reply.
The code you provided will return a list of TNS aliases for only one default ORACLE_HOME.
In this case, you can explicitly assign the default ORACLE_HOME. For example, if the Oracle InstantClient you installed is
located in the 'C:\OracleInstantClient' folder, and the TNS_ADMIN = C:\OracleInstantClient\NETWORK\ADMIN, you can change your code as follows:
Code: Select all
uses OraCall;
....
var
Enum: TOraServerEnumerator;
begin
Enum := TOraServerEnumerator.Create;
try
OracleHomes.AddHome('MyInstantClient', 'C:\OracleInstantClient');
OracleHomes.Default := OracleHomes.GetHome('MyInstantClient');
Enum.GetServerList(cboDatabase.Items);
finally
Enum.Free;
end;
end;
-
- Posts: 1
- Joined: Tue 12 Jul 2022 04:06
Re: Bug: TOraServerEnumerator does not check TNS_ADMIN environment variable
Your article is very good and informative, I always follow your article. You are an author that I love. Thank you for sharing! moviedle