SQLite concurrency from multiple EAs, Service etc

 
  1. Are there any issues on opening and operating on the same SQLite database file from multiple EAs, Service etc
  2. When opening a database connection on the same file from multiple EAs, will they get the same handle or different handle?
  3. How often does it flushes data to disk? Can some data be lost? Can the file get corrupted if MT5 crashes?
 

SQLite isn't designed for IPC.

You would have to manage lock/unlock similarly to using files.

 
Alain Verleyen #:

SQLite isn't designed for IPC.

You would have to manage lock/unlock similarly to using files.

If two EAs open same SQLite DB, do they get same handle to read/write? Thanks

 
bot #:

If two EAs open same SQLite DB, do they get same handle to read/write? Thanks

Read the suggestion under you first post:
Sharing Database Between MT5 Instances
Sharing Database Between MT5 Instances
  • 2021.04.28
  • www.mql5.com
I am using this article to make an automated optimization process for my EA. https://www.mql5...
 
r2d2:
  1. Are there any issues on opening and operating on the same SQLite database file from multiple EAs, Service etc
  2. When opening a database connection on the same file from multiple EAs, will they get the same handle or different handle?
  3. How often does it flushes data to disk? Can some data be lost? Can the file get corrupted if MT5 crashes?

I know that this is a late response, but I've only just been considering this myself. I did a quick test for multiple EAs accessing the same SQLite DB (and same table) concurrently. I had 15 instances of an EA reading data from the same table at the same time, and outputting data uisng Print(). It worked without any issues at all. However note that I was NOT updating the DB - just reading from an already populated table.

I had 8 EA instances running in one MT5 instance and 7 in a separate MT5 instance. It seemed to be very performant given that there were 4500 records in the table.  Note that I opened the database as follows using DATABASE_OPEN_READONLY. 

int hDatabase = DatabaseOpen("DB Name", DATABASE_OPEN_READONLY|DATABASE_OPEN_COMMON);

If you are going to be updating the DB from multiple EA instances you may well run into problems? You'd have to test it yourself. For me, I only need to read from it and so that's all I tested.

Reason: