Access to multiple databases with one RemoteDB

I have created a Windows Service project with THttpSysServer to which I have added a RemoteDB module.
Everything works as expected, but now I need to access multiple databases within the same SQL Server.
One RemoteDBClient will only connect to a single database, but another RemoteDBClient will connect to a different database.
Is this possible with a single RemoteDB module, or do I have to dynamically create a kind of array of RemoteDB modules within the same THttpSysServer.

You will have to create multiple RemoteDB modules, you can't do that with a single one, especially due to transaction control. I also recommend that you create multiple THttpSysServer, one for each RemoteDB module you create.

Following your recommendation, could several pairs of THttpSysServer plus RemoteDB be created, one for each database, in the same Windows Service.
Is there some limitation of memory or resources of the server to put, for example, 5 pairs in the same Windows Service.
It would be possible that after starting the main process in the ServiceModule of the Windows Service the several modules of the type ServerModule with one THttpSysServer plus RemoteDB pair on each one could be started and make StartServer/StopServer calls of each one of these ServerModules governed from another service administration program.

I didn't understand your last statement.
There is always memory or resource limitation. Hardware is limited. I don't think 5 servers would cause any issue though, RemoteDB is relatively lightweight.

Hola Wagner
Perdon por mi falta de conocimiento pero no entiendo el mecanismo para hacer multiples conecciones, a distintas bases de datos con RemoteDBhay algun codigo ejemplo?
Yo necesito acceder a distintos servidores RemoteDB y acceder a una base de datos diferente, pero del mismo tipo (firebird)

Hola Luis,

I have answered it above: you need to create one RemoteDB server per database (all servers can be in the same executable).
Use different URLs;

and so on

but I don't know how to do it, I made the server with the wizard, but how do I do the other services?

Each TRemoteDBServer is a different RemoteDB server. So basically you need to create a loop and create the components dynamically. Something like this:

for DB in MyDatabaseList do
  Server := TRemoteDBServer.Create(Self);
  // Now fill the properties like Dispatcher, Connection, BaseUri, etc.

Hola Wagner

Gracias, ya pude resolver. No encontraba la opcion de configurar TMSHttpConfig.exe, no podia saber donde estaba y desde ahi genere los distintos url. Perdon las molestias y gracias.
No escribimos....

Luis Roldan

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.