Client connect multiple sites

Hi,
I want to design the client connect to different sites DA server. Any best practice for advise? Each site has the same DB’s structure. Should I duplicate clientdatamodule only and set the targetUrl?

Hi,

You can store set of server address in .ini file and client app will ask at starting what address should be used.

Hi,
Client application need to connect all sites for data analysis and reporting. It is not only connect to single site and switch to other site.

Hi,

you can pass TargetUrl as a parameter for some method that will connect to server app

Hi,
If pass the parameter to TargetUrl, then I need to reconnect “ClientChannel” everytime. Right? It yes, then it looks like so trouble. The case is as same as “multiple DB connections” before.

Hi,

Not yet. You can return some datamodule instance like

function ConnectToServer(TargetUrl: string): TMyClientDataModule;

Hi,
It needs to using your “ConnectToServer” that switch the Clientdatamodule every time if the enquiry is search in Site A and Site B. This is my understanding. Right?

Hi,

you can store it in TStringList something like

list.AddObject('siteA',ConnectToServer(siteA));
list.AddObject('siteB',ConnectToServer(siteB));

later you can get stored object from list.Objects with

dm := TMyClientDataModule(list.Objects[i]);

Hi,
Noted with thanks. I will try it.