1)  Something else has the database open and locked.
2)  You are using Shared Cache 
3)  Something forgot to finalize a select
4)  The database is stored on a non-locally-attached filesystem
5)  An issue in the version of SQLite you are using (and you did not say which 
version you are using)
6)  A buggy filesystem driver (you did not say which one you are using)
7)  Badly designed antivirus software
8)  Badly designed file syncronization software (for example, storing the 
database in a directory that is being monitored and synced by badly designed 
software (dropbox for example)).

> -----Original Message-----
> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> bounces at mailinglists.sqlite.org] On Behalf Of david at andl.org
> Sent: Friday, 22 May, 2015 21:13
> To: 'General Discussion of SQLite Database'
> Subject: [sqlite] Under what circumstances can a table be locked when the
> database is first opened?
> 
> Question: Under what circumstances can a table be locked when the database
> is first opened?
> 
> My program does:
> 
> DROP TABLE IF EXISTS
> CREATE TABLE
> INSERT INTO (multiple times)
> SELECT * (for each row)
> 
> Run it once and it works perfectly. Run it twice and the DROP TABLE
> triggers
> the error:
> 
> SQLITE_LOCKED, database table is locked
> 
> Delete the database and run it again and it works. Just once.
> 
> Nothing in the documentation tells me how a table can be locked when the
> database is first opened. I'm using the raw C interface on Windows, so
> what
> can I be doing wrong?
> 
> The code is actually written in C#, but uses Interop to call the C API
> directly. The database open code looks like this. No open flags are used.
> 
> LastResult = (Result)sqlite3_open(path, out _dbhandle);
> 
> Regards
> David M Bennett FACS
> 
> Andl - A New Data Language - andl.org
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



Reply via email to