#1 2020-05-13 10:50:55

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Question: Using 1 Database for multiple mORMot Clients

Using an SQL Server for Example MySQL with mORMot TSQLRecords i have the Problem at a Customer:

We need 1 mORMot in DMZ and 1 internal but using the same SQL Server.
Both Client insert in the same TSQLRecord.

now wi get duplicate key errors.

Is it possible (by option) that both Client get the latest free key before inserting ?


Rad Studio 12.1 Santorini

Offline

#2 2020-05-13 12:10:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Question: Using 1 Database for multiple mORMot Clients

You could try to set EngineAddUseSelectMaxID=true.
It will use a "select max(ID)" before inserting. But it will be slow, and they still could be some duplicate key errors in some rare cases.

I see two potential solutions:
1. Use the new Relay feature and put it in the DMZ;
2. Use TSQLModel.SetIDGenerator on each node.

Offline

#3 2020-05-13 12:19:12

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,539
Website

Re: Question: Using 1 Database for multiple mORMot Clients

In our case we use a analogue of SetIDGenerator for such cases with aIdentifier parameter = instance #

Offline

#4 2020-05-18 20:19:30

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: Question: Using 1 Database for multiple mORMot Clients

ty i'll try your ideas


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB