- Home /
SQLite Except: The database file is locked
Hi
I'm developing a game with Sqlite and WCF. But they only work fine together at the first run, if I try play scene again, console show "SQLite Except: The database file is locked", Help!
Codes below
LobbyServiceClient _client = new LobbyServiceClient(_binding,_endpoint);
_client.DoSomething();
try {
if (_client.State!=CommunicationState.Faulted) {
//_client.Close();
_client.Abort();
}}catch (System.Exception ex) { _client.Abort(); }
string _sql ="Some Select Function";
SqliteHelper _db = new SqliteHelper("client.db");
_db.Conn.Open();
DataTable _dt= _db.Q(_sql);
_db.Conn.Close();
have you open your same database with "sqlite manager" at the same time?
Thanks for your reply Devesh.But no I didn't use it. All I do is just new a SqliteConnection(string) before open connection, and it throw this exception when next time I try to open connection(always can make it at first time).
O$$anonymous$$, close connection in finally block, may be solve your problem.
Answer by zhuchun · Nov 30, 2012 at 02:54 PM
Here's a temporary solution: Put WCF codes between SqliteConnection.Open() and Close(). Thanks to Devesh! TY!
Your answer
![](https://koobas.hobune.stream/wayback/20220613084734im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
how to access and modify my existing database made by DB browser for SQLite in unity after build 0 Answers
why sqlite can't conneted after build in PC (.exe) 0 Answers
Deleting the main database at runtime. 0 Answers
SQLite Query error 0 Answers
how to use database in unity for developing android games? 0 Answers