You are not logged in.
Sorry to write on a suck ten years old thread, but it will be easier to me to stumb on again, and i think it should pinned ![]()
Reading it again made me realized I took a bad direction on a feature of the software I am working on, even if I read ten times the doc since my first mORMot introduction.

Ok, back from resto, I cloned mORMot2-3.35.5, compiled the project, and everything is working as expected.
Then I switched to mORMot-3.36.0, compiled the project, and it works as expected too ... externals tables are created.
So everything is working, sorry this post.. if someone has a hint on what could be happening.. like a MySQL cache "issue" or something do not hesitate to write a comments. Thanks.
PS: The only things I didn't tested it's to restart the database server.
I think I am doing things as it should. To be honest, I just pulled mORMot2 and compiled.
Model:
function DataModel: TOrmModel;
begin
Result := TOrmModel.Create([
TOrmLprPlateRawData
], ROOT_NAME);
end;Server Initialization:
// get the shared data model
fModel := DataModel;
// use external database for all tables
VirtualTableExternalRegisterAll(fModel, fProps);
// create the main mORMot server with authentication required
fRestServer := TRestServerDB.Create(fModel, 'vremotesagas.db', true);
fHttpServer := TSQLHTTPServer.Create(PORT_NAME, [fRestServer], SERVER_URL, useBidirSocket, 32, secNone);
fHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
// create tables or fields if missing
fRestServer.CreateMissingTables;PS: To explain the different table name between the two version, I renamed it on new version.
Edit:
Pastebin of the full start log of the server : https://pastebin.com/jSgCvjWR
Hi,
I updated my project to the latest mORMot2 with SQLite static libs 3.36 and the latest Zeos lib and it look like that External Tables are not created anymore, it's possible that I missed something between two updates of the framework, I didn't saw a note about that.
With VERBOSE logs enabled, when the server start (CreateMissingTable log line reduced) :
> Old version :
[...]
20210913 11135418 DB mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) CreateMissingTables on {"TSqlDatabase(0378b490)"}
20210913 11135418 DB mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) GetTables=["AuthGroup","AuthUser","PlateRawData"]
20210913 11135418 + mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData
20210913 11135418 info mormot.orm.sql.TRestStorageExternal(0344a720) TOrmPlateRawData as PlateRawData {"TSqlDBZeosConnectionProperties(02d54ec0)":
{Engine:"SqlDBZeos",ServerName:"localhost",DatabaseNameSafe:"remotesagas",UserID:"foobar",Dbms:"dMySQL",DbmsEngineName:"MySQL",BatchSendingAbilities:["cCreate"],BatchMaxSentAtOnce:4096,LoggedSqlMaxSize:2048,UseCache:true,StatementMaxMemory:536870912,RollbackOnDisconnect:true,DateTimeFirstChar:84,DBMSName:"mysql"}}
Server={"TRestOrmServerDB(02de2b80)":{StaticVirtualTableDirect:true,DB:{"TSqlDatabase(0378b490)":
{FileName:"vremotesagas.db",UseCache:true,UseCacheSize:16777216,CacheSize:10000,PageSize:4096,PageCount:22,FileSize:90112,Synchronous:"smFull",LockingMode:"lmNormal",OpenV2Flags:6,SQLite3Library:{"TSqlite3LibraryStatic(02d833a0)":{Version:"TSqlite3LibraryStatic 3.35.5 with internal MM"}}}}}}
[...]
20210913 11135419 + mormot.db.sql.zeos TSqlDBZeosStatement.Step (1203)
Server is now running on mykingspark.fr:61337/root> New Version
20210913 11130122 SQL mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 206us vremotesagas.db returned 14 rows SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20210913 11130122 DB mormot.orm.sqlite3.TRestOrmServerDB(02e32040) CreateMissingTables on {"TSqlDatabase(035fce30)"}
20210913 11130122 DB mormot.orm.sqlite3.TRestOrmServerDB(02e32040) GetTables=["AuthGroup","AuthUser","LprPlateRawData"]
20210913 11130122 SQL mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 4us vremotesagas.db PRAGMA locking_mode=NORMAL; = true
20210913 11130122 - 00.000.278
20210913 11130124 info Server is now running on localhost:61337/rootThere is no errors in logs.
Statement "mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData" is missing on the log on new version.
Statement "mormot.db.sql.zeos TSqlDBZeosStatement.Step" is missing on the log on new version.
Any hint ?
Ok thanks - your comment make things clearer.
I didn't checked my code source right now but I don't remember to have changed something after my own post, but opening the same db while reading your post :

I will check if I changed something and will report here
PS: I dont mean there is a bug in mormot2, I am just trying to understand what's is going ![]()
Hello,
Just to be clear, the project works - everything is fine.
I am used to explore the SQLIte database with SQLiteSpy, but this morning after an update of my mORMotClient unit and a compilation, when I open the DB with the tool (same with HeidiSQL) I have theses error, check the screenshot :

Sorry to post that, I dont want to scracth my head for hours trying to understand the error - any idea guys ?
Yes, you must use
TDocVariantData.Names._Count - 1Only TTaskDialog
And `mORMotUIEdit (mORMotUI*)` could be cool too ![]()
But I do have a question - it seems that TSynLog cannot capture the StackOverFlow exception that happened in a background thread?
This might be due to OTL. Read this sentence about Exception notifications: http://www.omnithreadlibrary.com/book/chap14.html - then you can try to call your ILog.Log() mecanism inside your exception filter.
Just in case, read @ab's and @mpv's comment there : https://synopse.info/forum/viewtopic.php?id=5793
I have also more than 80 clients with servers in production (on mormot v2 now) and no TSynLog issue since months. I can remember having issue with TSynLog but it was my learning curve that was not completed, and the issue was introduced by me, it was also a bit hard to spot as I am mixing mORMot2 and OmniThreadLibrary.
Thanks @ab, effectively, this is something I didn't think of.
Hi everyone,
I am maybe starting a dumb question, it's possible to have a TSQLHTTPServer running with useBidirSocket and secSsl ?
I am trying to upgrade a current project to use SSL because I have a ServiceMethod which return HTML content with some javascript. In this javascript code, I call the WebAPI "navigator.share" which only works on secure (HTTPS) domains.
So I created a self-signed certificate, registered the route, everything good at this point, I can browse the document on HTTPS and execute the javascript code.
The server answer some interface services, and send push notification through websockets, but to get HTTPS working, I had to change "useBiDirSocket" to "useHttpApiRegisteringURI" to the server declaration, but after this change, I am out of WebSockets support :
fRestServer := TRestServerDB.Create(fModel, 'vremotesagas.db', true);
fHttpServer := TSQLHTTPServer.Create(PORT_NAME, [fRestServer], SERVER_URL, useHttpApiRegisteringURI, 32, secSsl); // initially set with useBidirSocket and secNone
// fHttpServer.WebSocketsEnable(fRestServer, SAGAS_TRANSMISSION_KEY);//.Settings.ClientAutoUpgrade := true;If I set "useBiDirSocket" with "secSsl" and try to browse a document on HTTPS, i get an AV on "mormot.rest.http.server" line 1020 :
// call matching TRestServer.Uri()
call.Method := Ctxt.Method;
call.InHead := Ctxt.InHeaders;
call.InBody := Ctxt.InContent;
serv.Uri(call); <------------------- serv is nilOk, thanks @ab
Hi,
Is there a project sample somewhere ? if not maybe someone have one helloworld project to share on Github
?
So the problem should be elsewhere.
Look like in Zeoslib, see comment on line 4640 of the file "ZDbcMetadata.pas" (zeoslib 7.2.10):
{**
Set the Wildcards character for WildcardsArray variable.
Overrride this method if the wildcards character is different in other database
}
procedure TZAbstractDatabaseMetadata.FillWildcards;
begin
SetLength(WildcardsArray,2);
WildcardsArray[0]:='_'; //<---- seems to be a trublemaker, no idea how to test it with our tests. See http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=13184
WildcardsArray[1]:='%';
end;If you read the post following the link, you will find a workarround and a discussion there: https://zeoslib.sourceforge.io/viewtopi … 2&p=160450
Okay, tried with your sample and I can confirm then.
Just to say that it works on my side on Delphi 10.4.2 pro.
The only things I have to fix afterward, it's the included units (still generate "unit uses" from mORMot v1) :
uses
SynCommons,
mORMot;and to comment the TTextWriter initialization :
// TTextWriter.RegisterCustomJSONSerializerFromText
[...]Compiled / run successfully on Delphi Sydney 10.4.2
Thanks for QuickJS ![]()
Just a small question to be sure, as the last post here is from 2017, the EWB book 2nd edition is about mORMot too, right ?
Oke @ab, thanks you.
Downloading the source and the static files version 3.34.1 from there : https://github.com/synopse/mORMot2/releases
ask for the 3.34.0 static files when running an executable, is this expected ?

Currently for Windows instances we always create a copy of a active log file before opening it in LogView to prevent such unexpected errors
Thanks you @mpv, that's what I ended doing ![]()
Thanks for the hint @ab, I reproduced it, in fact, I was opening the log file with the LogViewer while the soft was running.
Hello all,
Two hours ago I suffered a "crash" and I am trying to find the culprit (me for sure
) as I am quite new to this framework.
Note: It is possible that timeout are misconfigured and that I misunderstand the flow of the session expiration/client re-connection even if everything can run a week without any error or interruption
The setup is the following:
- Clients and server are built on mORMot2
- a database server (MariaDB 10) on a Windows server
- the (mORMot) server is an instance of TSQLHttpServer and hosted on the same computer as the database server
- the (mORMot) clients (~83 in the wild) are instance of TRestHttpClient and run on Windows 7 embedded
----------------
Server definition and timeout (maybe wrong and I should set it to a greather value) :
constructor TSagasServer.Create(Props: TSQLDBZEOSConnectionProperties);
var
Conn: TSQLDBConnection;
begin
fProps := Props;
fProps.ConnectionTimeOutMinutes := 1;
[...]
end;Client definition and timeout (3000 ms)
fClient := TRestHttpClient.Create(AnsiString(SERVER_URL), PORT_NAME, fModel, false, '', '', 3000, 3000, 3000);----------------
Suddenly, all the clients (~83) disconnected at the same time (by timeout ? from what I see in the client logs) :
> 16/03/2021 08:55:00.496 Exception EWinHttp {Message:"winhttp.dll error 2EE2 (timeout)"} [] at 6af783 stack trace API (TZOracleConnection.PingServer)
And on the server side, 15 seconds before (at 08:54:46) :
> 3/16/2021 08:54:45.944 Enter mormot.rest.sqlite3.TRestServerDB(02b56e10).URI PUT root/Capteurs/10?session_signature=258902d3016d2b0916971c8c in=464 B
> 3/16/2021 08:54:45.944 User auth mormot.rest.server.TRestServerRoutingRest(0308cba0) kingspark/629736147 1.2.3.4
> 3/16/2021 08:54:45.944 SQL mormot.db.sql.zeos.TSqlDBZEOSStatement(02b76530) ExecutePrepared 1.42ms wr=1 update Capteurs set NumeroConcessionnaire=0,NumeroParking=15,NumeroBorne=1,Etat_Monetique=0,Etat_CB=0,Etat_Imp_Sortie=0,Etat_Imp_Sortie_Papier=0,Etat_Imp_Sortie_Papier_Low=0,Etat_Laser_Entree=1,Etat_Laser_Sortie=0,Etat_Imp_Entree=1,Etat_Imp_Entree_Papier=0,Etat_Imp_Entree_Papier_Low=0,Barriere_Entree_Open=0,Barriere_Sortie_Open=0,Type_SIP=0,Etat_Connexion_SIP=0,WatchDog=0,WatchDog_UserStop=0,Update_time='2021-03-16 08:54:36',Site_Link=0 where ID=10
> 3/16/2021 08:54:45.944 Server kingspark 1.2.3.4 PUT root/Capteurs Write=200 out=0 B in 1.56ms
> 3/16/2021 08:54:45.944 Leave 00.001.574
> 3/16/2021 08:54:46.240 Enter mormot.rest.sqlite3.TRestServerDB(02b56e10).URI POST root/UpdateService.Get?session_signature=258902850056589b9976698e in=46 B
> 3/16/2021 08:54:46.240 User auth mormot.rest.server.TRestServerRoutingRest(0308cba0) kingspark/629736069 1.2.3.4
> 3/16/2021 08:54:46.240 Service call mormot.rest.sqlite3.TRestServerDB(02b56e10) IUpdateService.Get[{numeroParking:15,numeroBorne:3,typeBorne:1}]
> 3/16/2021 08:54:46.288 New run ==================================================
3/16/2021 08:54:52.208 Exception EHttpApiServer {LastError:1229,LastApi:"hSendHttpResponse"} [HttpSvr 61337 root THttpApiSvr] at 6c3aa7
About this last error exception, I read on this forum that it could be a timeout misconfiguration..
And the really strange part (to me) is the "New Run" event which poped multiple times each 100ms on the server side - I don't really know at this time what this mean.. please see the following pastebin log file :
> https://pastebin.com/9ZL8ndxj
----------------
To get back running everything, I paniked and restarted the server manualy, the first time I was still getting the execption ERROR_CONNECTION_INVALID.
Any hint please ? What I can/should add to this post so it will be more clear to you and easier to help ?
Thanks yo guys, have a nice day.
Note that the ORM with external DB has not be fully validated yet.
Feedback is welcome, because it is hard to validate on all DB/Library/OS combinations out there...
Thanks @ab,
I will test with external db and I will report it.
Awesome, does it mean I can clone the project and recompile my fresh project under mORMot 2 ?
Ok I understand much better. I know it's not ready for production, I am testing it and preparing myself for the release, as well contributing by reporting bugs.
Thanks Arnaud for the answer and again for the work put in Mormot.
Hello,
I am new here and I adopted a Mormot v1 some weeks ago and I must say that I am astonished by the strength and the simplicity of the framework
I started to port a - still small - project to Mormot v2 and I ran into an AV when running the program (quite simple), it look like it's related to Zeos and not Mormot but as I am a beginner with Mormot I prefer to ask/post first here.
My setup :
- fresh Delphi Sydney 10.4.1 install (tested on earlier version 10.4 and found a post here in this forum about a compiler bug reported which should have been fixed in 10.4.1)
- fresh clone of mormot2
- latest ZeosLib 7.2.8 (also tested old version)
I can compile and run the test without any issue. But once I try to use external MariaDB database with ZeosLib (it works fine with Mormot v1 and Zeos 7.2.8)
So starting with the following code :
begin
var
Props: TSQLDBZEOSConnectionProperties;
aPassword: RawUTF8; // aPassword is set on command line
Props := TSQLDBZEOSConnectionProperties.Create(RawUTF8('zdbc:mysql://localhost:3306/mydatabase?username=mylogin;password=' + aPassword), 'mydatabase', 'mylogin', aPassword);
[...]
end;It compile fine, but when running the program crash there :
procedure ClassToText(C: TClass; var result: RawUTF8);
var
P: PShortString;
begin
if C = nil then
result := ''
else
begin
P := PPointer(PtrInt(PtrUInt(C)) + vmtClassName)^;
FastSetString(result, @P^[1], ord(P^[0])); ❌
end;
end;The call stack :
Any hint ?
Thanks Arnaud and all contributors for this framework ![]()