Embarcadero C++ Builder 11.2 Architect.
I trying to access the Multi-Tenant information in my RAD Server programmatically. Access is not provided via EMSInternalAPI to get at that information, so I tried the following:
The .dfm file, localhost is the remote server running IIS and Rad Server:
object TenantModuleResource: TTenantModuleResource
Height = 258
Width = 441
object qryTenants: TFDQuery
Connection = TenantConection
Left = 72
Top = 40
end
object FDStanStorageJSONLink: TFDStanStorageJSONLink
Left = 272
Top = 128
end
object FDPhysIBDriverLink: TFDPhysIBDriverLink
Left = 272
Top = 48
end
object TenantConection: TFDConnection
Params.Strings = (
'Server=localhost'
'User_Name=sysdba'
'Password=masterkey'
'Database=C:\Data\emsserver.ib'
'InstanceName=gds_db'
'Port=3050'
'DriverID=IB')
Left = 72
Top = 128
end
end
The code:
void TTenantModuleResource::Get(TEndpointContext* AContext, TEndpointRequest* ARequest, TEndpointResponse* AResponse)
{
std::unique_ptr<TMemoryStream> oStr(new TMemoryStream());
qryTenants->Close();
qryTenants->SQL->Text = "SELECT tenantid, tenantname FROM tenants";
qryTenants->Open();
qryTenants->SaveToStream(oStr.get(), TFDStorageFormat::sfJSON);
AResponse->Body->SetStream(oStr.release(), "application/json", true);
}
static void Register()
{
std::unique_ptr<TEMSResourceAttributes> attributes(new TEMSResourceAttributes());
attributes->ResourceName = "tenants";
RegisterResource(__typeinfo(TTenantModuleResource), attributes.release());
}
and ended getting a log error of unknown "...Win32 error 10060" which is a timeout from what I can tell. I've seen where the Interbase docs suggest that there is no client license when that error is thrown.
I have the RAD Server Site license, but not the client license, however I would like to have the ability to work with the tenant records without using the Multi-Tenant Console app.
My questions is does anyone know of a way to programmatically get to the Tenant data in the emserver.ib database?