You are not logged in.
Hi all. We already have an Oracle database since ten years ago, and until now our Delphi applications are client/server. Now we want to build a REST server using Mormot, but we have a problem.
In Oracle we have four schemas, and each one have its one tables... How can we model that scenario using Mormot?
Maybe creating four connection (aProps[1] := TSQLDBOracleConnectionProperties.Create() ... aProps[4] := TSQLDBOracleConnectionProperties.Create), and eventually four Models for every connection (aModel[1] := CreateModel1 ... aModel[4] := CreateModel1), using VirtualTableExternalRegisterAll() with each pair? What about REST server where only one model we can use (TSQLRestServerDB.Create(model,...)) ?
I appreciate the help you could give us.
Regards,
Sergio
Offline
The schema is not about the connection, but about the table.
A single TSQLDBOracleConnectionProperties is enough.
And you can customize the schema during external database mapping.
But since your database is old, make sure that it meets the mORMot ORM requirements, mainly an Integer primary key for the tables...
For server-side REST process, your are not forced to use the ORM. Not at all.
What I have used with legacy databases is:
- interface based services to publish the REST process;
- define an interface and a class for an agnostic Persistence service;
- SynDBOracle direct connection access to the database for better performance, and direct JSON/variant result integration;
- reuse existing SQL statements, without the ORM, when it is not compatible (primary key), or too complex;
- use the ORM for new or compatible tables.
Offline
Hi. When you say "external database mapping" what do you mean? The TSQLRecord classes? Can you give us an example of how to map two tables belonging to two different schemes in Oracle? Thank you for your quick response.
Sergio
Offline
Check the doc about external databases.
It is pretty clearly explained.
See e.g. https://synopse.info/files/html/Synopse … l#TITL_146
Offline