ThinkGeo.com    |     Documentation    |     Premium Support

SQLite error (5): database is locked

MapSuite Team,

While in Visual Studio Debug mode I notice the below lines in the Output Debug Window:
SQLite error (5): database is locked
SQLite error (261): database is locked

Fifteen of my layers are in their own unique SQLite database(one layer per database).

I’m getting this error when the extent changes and/or ZoomLevel changes as well as on a Center Map. This occurs frequently that it concerns me, but it does not happen all the time. I’m sure it’s a timing issue.

Sometimes both the 5 & 261 errors are received when a center map is performed.

I have multiple Map Overlays with each having a mixture of SQLite Layers and ShapeFileFeatureLayer. When the Overlay is set to DoNotLock the 5 & 261 errors are encountered. When set to Lock only the 5 error is encountered.

I’m currently using V9.0.0.190.

Any advice on this?

Thanks,
Dennis

Hi Dennis,

Thanks for the feedback. I recreated this issue which I will let out developers know that.

There is a workaround for this: please try changing the overlay.TileType = TileType.SingleTile to avoid that.

Any updates I will let you know.

Thanks,
Peter

Thanks Peter. Would you post when the fix is available in a build?

Thanks,
Dennis

Hi Dennis,

I did more research and found that this issue may be caused by the “database busy” issue. Please try setting the “Busy Timeout” to a proper value.The connection string like:

@"Data Source=catalog;Version=3;ReadOnly=True;Busy Timeout=60;"

More information about that please refer to http://www.sqlite.org/faq.html#q5.

Thanks,
Peter

Peter,

I believe that both of my SQLite posts are interrelated, which I did not realize at first. I am successful at setting journal mode = off. Once it was off then no more SQLite database locked errors.

I will still add ReadOnly=True;Busy Timeout=60 to the connection string.

Thanks for your assistance.

Regards,
Dennis

Hi Dennis,

Thanks for the sharing. It’s very helped for the others who encounter the same issue.

Thanks,
Peter