You are not logged in.
I use Delphi program to open SQLite database with TSQLRestServerDB. Lockingmode: = lmnormal. The compiler runs on Linux by fpc , such as : fpc.exe -Tlinux -Px86_64 -MObjFPC -Scghi -Cg -O1 -l -vewnhibq -FiC:\e\SS2\SysDataManager\mymormot\lib\x86_64-linux -FiC:\lazarus32\ccr\mORMot -FiC:\lazarus32\ccr\mORMot\CrossPlatform -FiC:\lazarus32\ccr\mORMot\static\x86_64-linux -FiC:\e\ss\ziliao\synapse40\source\lib -FuC:\lazarus32\ccr\mORMot -FuC:\e\ss\IRSoft\souce\component -FuC:\lazarus32\ccr\mORMot\SQLite3 -FuC:\lazarus32\ccr\mORMot\static\x86_64-linux -FuC:\e\ss\ziliao\synapse40\synalist-code-r209-trunk\synalist-code-r209-trunk -FuC:\e\SS2\SysDataManager\mymormot\jiekou -FuC:\e\SS2\wavpubfunc -FuC:\e\SS2\SysDataManager\mymormot\ -FUC:\e\SS2\SysDataManager\mymormot\lib\x86_64-linux\ -FEC:\e\SS2\SysDataManager\mymormot\ -oC:\e\SS2\SysDataManager\mymormot\blackir blackir.lpr
When the second program is opened, an error is reported: esqlite3exception {"errorcode": 26, "sqlite3errorcode": "secnotadb", "message": "error sqlite_notadb (26) [dbopen] using 3.34.1 with ADB = nil"}.
But it is possible to run on windows.
What is the matter? How should it be solved?
Offline
Did you try the WAL mode?
In TSqlDataBase.DBOpen, we use unix-excl mode on POSIX, as requested by https://www.sqlite.org/vfs.html
Anyway, this is not a good idea to open the DB in normal mode. I usually only use exclusive mode, for best performance, and also enhanced security.
If you need to access the SQlite3 database concurrently, while it is used in a service, use the service API to access it, not the DB file.
Offline
Thank you for your reply. After reading the document, I didn't find "WAL mode", but I saw standard UNIX vfses and saw that the opening method was "UNIX excl" in the source code. I changed it to "UNIX dotfile", and there is no lock database after recompiling and running.
My application has another node JS to run web access SQLite. But I still don't know how big the risk is and whether it is an appropriate plan.
If don't lock the database, which way is safer?
Thanks .
Offline
Let the node JS call a mORMot service on the host: it would be faster, and also more maintainable (you could move Node and mORmot servers in two diverse VM for instance).
Why using the mORMot service to access the database would also be faster? Because the DB would be open in memory, with proper caching, and more efficient JSON creation.
Note also that enabling multi-process opening slows down the DB process a lot, on both sides (mORMot and Node).
Letting other process access the SQLite3 file is unsafe by design, because a security flow in Node could alter the data for instance.
It is also a design/architecture flaw. It would spread the logic in both JS and pascal code, which means more maintenance for no benefit.
Offline
Thank you for your suggestion. Our final plan is consistent with what you said.
Thank you very much.
Offline