Hello,
I have an app that works in windows devices, the database is located in a shared folder in a server, and up to three user are doing the data entry. When only one devices works, all is working properly, however when all are working, some time gives the message "THERE WAS AN ERROR SAVING THE CASE", or in automatic savepartials "THERE WAS AN ERROR WRITING TO THE DATA SOURCE: DATABASE IS LOCKED".
I do not know why the csdb is locked, or why the app maintain it locked to the rest of the users.
Is it a problem in the rights of the database in the server?,
I will apreciate your comments.
Thanks
Error writing csdb datafile
-
savy
- Posts: 201
- Joined: December 27th, 2012, 1:36 pm
Re: Error writing csdb datafile
CSDB file are SQLite files. SQLIte locks the files when writing to the database. This is the reason you are seeing this error message. Please see the helps for Networked Data Entry https://www.csprousers.org/help/CSPro/ ... entry.html
Your workarounds are
1. Have enumerators retry saving when this error appears. This usually works since the locks are brief.
2. Disable Auto Save Partial and programmatically do savepartial at specific points to reduce the incidence of these locking events.
3. Follow the sync approach described in our Networked Data Entry documentation.
The next version of CSPro will allow directly writing to the CSWeb MySQL database repository which will avoid these issues.
Your workarounds are
1. Have enumerators retry saving when this error appears. This usually works since the locks are brief.
2. Disable Auto Save Partial and programmatically do savepartial at specific points to reduce the incidence of these locking events.
3. Follow the sync approach described in our Networked Data Entry documentation.
The next version of CSPro will allow directly writing to the CSWeb MySQL database repository which will avoid these issues.
-
Mariovaisman
- Posts: 153
- Joined: February 11th, 2013, 8:26 am
Re: Error writing csdb datafile
Thank you Savy,
I see that I can check the savepartial() function return code and then f the error occur, I can wait 1 or 2 seconds and retry, however how I can manage the situation hen the case is completed?.
Thanks
Mario
BTW, I posted 2 times because the first time disappeared from the list, now both are in the list. Thanks
I see that I can check the savepartial() function return code and then f the error occur, I can wait 1 or 2 seconds and retry, however how I can manage the situation hen the case is completed?.
Thanks
Mario
BTW, I posted 2 times because the first time disappeared from the list, now both are in the list. Thanks
-
savy
- Posts: 201
- Joined: December 27th, 2012, 1:36 pm
Re: Error writing csdb datafile
Removing autosave will reduce the occurrence of these concurency issues. An option is to have a control field at the end of the questionnaire where you first do savePartial and retry it until succeeding before the postproc of the level is processed.