Page 1 of 1

TOracleHomes Usage

Posted: Sat 01 Nov 2014 18:23
by redhair
Hello ODAC Support Team,

how can i get the Oracle-Homes for a own logon-dialog ( without the use of the TConnectDialog component ) ?
I've tried the following code, but the name property isn't filled and the Count-Property has a wrong value.

Code: Select all

std::unique_ptr<TOracleHomes> oracleHomes(new TOracleHomes());
oracleHomes->Init();

if (oracleHomes->Inited) {
    for (int i=0;i< oracleHomes->Count;i++)	{   // Count is always 1 
       UnicodeString path = oracleHomes->Homes[i]->Path;//filled with the default home path
       UnicodeString name = oracleHomes->Homes[i]->Name;  // empty !!! 
	// ....
    }
}
oracleHomes->Release(); 
If i use an TOraSession-Object at design-time or the Session Editor
i can see on the "Connect"-TabSheet in the "Home"-ComboBox two items.
1.OraClient11g_home1
2.OraClient12Home1_32bit

Info - TabSheet :
OCI: Version 11.2.0.1.0
DLL: c:\app\madmin\product\11.2.0\client_instant32bit\oci.dll
Home [OraClient11g_home1]: c:\app\madmin\product\11.2.0\client_instant32bit
Home [OraClient12Home1_32bit]: C:\app\client\madmin\product\12.1.0\client_12c_32bit
Default Home [OraClient11g_home1]: c:\app\madmin\product\11.2.0\client_instant32bit
Current Home: c:\app\madmin\product\11.2.0\client_instant32bit
Call style:
Oracle:

Thanks for any help.

Re: TOracleHomes Usage

Posted: Mon 03 Nov 2014 09:21
by AlexP
Hello,

You needn't to create a new TOracleHomes instance. To retrieve the Homes list, you can use an initialized global variable OracleHomes, declared in the Oracall module:

Code: Select all

#include "OraCall.hpp"
...
for (int i = 0; i < OracleHomes->Count; i++) 
{
  ShowMessage(OracleHomes->Homes[i]->Name);
  ShowMessage(OracleHomes->Homes[i]->Path);
}
...