More extensive sample: OracleCI

Roald Andresen

Member²
Hi

Could someone provide me with a more complete example on how I use OracleCI to query/parse tnsnames.ora?
I keep getting an empty list from OracleCI.OracleAliasList.

:-)Roald
 
Here is my test tnsnames.ora:

# TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

sid1.company.no=
(DESCRIPTION=(ADDRESS_LIST = (ADDRESS =(COMMUNITY = TCP.world)(PROTOCOL = TCP)(Host = host1)(Port = 1521)) ) (CONNECT_DATA=(SID=TDB)(SERVER=DEDICATED)))

sid2.company.no = (DESCRIPTION=(ADDRESS_LIST = (ADDRESS =(COMMUNITY = TCP.world)(PROTOCOL = TCP)(Host = host2)(Port = 1521)) ) (CONNECT_DATA=(SID=SVVFARM)(SERVER=DEDICATED)))

sid3.company.no =
(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = host3)(PORT = 1521)) ) (CONNECT_DATA=(SID=ONBASE)(SERVER=DEDICATED)))

And here is the code I'm using:
procedure Tdlg_MasterLogon.setSession(s: TOracleSession);
var
aliases : TStringLIst;
begin
aliases := TStringList.Create;
oracleci.InitOCI;
if oracleci.DLLLoaded then
aliases := OracleCI.OracleAliasList;
end;

The OracleAliasList is executed but returns an empty list. I have verified that OracleCI.TNSNames points to the right file.

:-)Roald
 
Works fine for me with the tnsnames.ora contents you provided and you example code. I added a ShowMessgage(Aliases.Text) to verify this. I am using Direct Oracle Access 4.0.3. Perhaps you are using an older version? If so, which one?
 
Using ShowMessage also give me a correct answer. However, I didn't get anything through the debugger. That is more likely Borland's problem.

Sorry about the inconvenience.

:-o Roald
 
Back
Top