You must call
CoInitializeEx(nil, COINIT_MULTITHREADED);
to initialize the COM library that will be used by the db access component.
The best place is to use a middleware so you are sure all threads will have it called. You can do that using the TXDataServer.OnModuleCreate event:
procedure TDataModule2.XDataServer1ModuleCreate(Sender: TObject;
Module: TXDataServerModule);
begin
Module.AddMiddleware(TAnonymousMiddleware.Create(
procedure(Context: THttpServerContext; Next: THttpServerProc)
begin
CoInitializeEx(nil, COINIT_MULTITHREADED);
try
Next(Context);
finally
CoUninitialize;
end;
end
));
end;