ElevateDB Aurelius connection "Database Name XXX already exists" error

I am using Aurelius to create a remote server for an XData project

My database is ElevateDB, which I have used for a long time on VCL projects.

Following advice in this post:

ElevateDB XDATA Server Database name already exists

I have written an "BeforeConnect" event for my Database components.

In this mode, the FMX client Application works well while there is a single user connection. However when a second user logs on, an error message occurs:

Database name '2330854308656' already exists.

This is the "BeforeConnect" code:

procedure TServerContainer.EDBDBBeforeConnect(Sender: TObject);
var
DB: TEDBDatabase;
begin
DB := TEDBDatabase(Sender);
if DB.DatabaseName = '' then
DB.DatabaseName := IntToStr(NativeInt(DB));
end;

The database supports multiple users. I use it widely with VCL Applications and it functions well with multiple users.

The requests that are causing the errors are very trivial: Returning a single row of data with just a few fields.

Are there any other properties I should be setting on my Server Application to avoid this issue?

I have the following components on the data-module

SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher;
XDataServer: TXDataServer;
AureliusConnection: TAureliusConnection;
XDataServerCORS: TSparkleCorsMiddleware;
Sess: TEDBSession;
EDBDB: TEDBDatabase;

They are set up following examples from TMS and work fine for a single user.

  1. Is your TEDBDatabase.DatabaseName property empty?
  2. Is the BeforeConnect event effectively firing?
  3. is your TEDBDatabase component disconnected at design-time?

There is no much secret here. XData "duplicates" the TEDBDatabase component for multiple connections. The code must make sure that each new TEDBDatabase component has a different DatabaseName value, that's all.

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