Unable to access a database while backtesting

 
string filename="Mql5CalendarEvents.db";
//--- create or open the database in the common terminal folder
   int db=DatabaseOpen(filename, DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE |DATABASE_OPEN_COMMON);
   if(db==INVALID_HANDLE)
     {
      Print("DB: ", filename, " open failed with code ", GetLastError());
     }
Every time I run this through the backtestor it returns a 5121 error (ERR_DATABASE_INVALID_HANDLE), that does not otherwise occur when I run it properly on live trading. I have it running everytime OnTick and is instrumental to my code as you can see it holds Calendar events data. I looked around for ages but saw not forum posts on this issue. Does anyone know if you even can access a database through the MT5 backtestor or not? If so what am I doing wrong?
 
Sebastian Clarke:
Every time I run this through the backtestor it returns a 5121 error (ERR_DATABASE_INVALID_HANDLE), that does not otherwise occur when I run it properly on live trading. I have it running everytime OnTick and is instrumental to my code as you can see it holds Calendar events data. I looked around for ages but saw not forum posts on this issue. Does anyone know if you even can access a database through the MT5 backtestor or not? If so what am I doing wrong?
I am quite sure, I did this in tester/debugger... And I remember it working.

Have you tried with a normal file?

And debugged it?
 
Dominik Christian Egert #:
I am quite sure, I did this in tester/debugger... And I remember it working.

Have you tried with a normal file?

And debugged it?
By normal file what do you mean exactly?
 
Sebastian Clarke #:
By normal file what do you mean exactly?
try to use FileOpen() like you did with DatabaseOpen...

It should work the same, but with a normal file instead of a database.
Reason: