i have a background exe which continuously writes some data to the database
now when the exe is writing the data, another application reads some data from the same database.
this application also controls the exe(starts and stops it).

first i get System Error -14(database already in use i suppose) while opening the databse for reading.
then when i actually prepare the database for the sql query, i get DBMS 2 panic which means database parameter
has remained uninitialized.

but if i read the same database when background exe is not writing to it, i am able to read it properly.

i am using the following code to open the database

TInt errCode = iItemsDatabase.Open(iFsSession, DBFileName,_L(" "),RDbNamedDatabase::EReadWrite);
where iItemsDatabase is RDbNamedDatabase and DBFileName is the path of the .db file

what i think of is, do i actually need to open the database from the application while the background exe
is still writing to database? i am saying this because the database is already opened by the background exe

what should i do here?
can u suggest me what might be the problem in here or give a hint or some solution?