database is locked
(1) By Takeshi (takeshi) on 2020-03-20 10:40:52 [link] [source]
i created a database with foreign key, then I saved it. After that I tried to change something (add a column, change type of column, etc.) but it showed me that database is locked. I can not change anything with this table. What shoul I do? Thanks.
(2) By Gunter Hick (gunter_hick) on 2020-03-20 11:22:21 in reply to 1 [link] [source]
You are probably acessing the database from more than one process. You need to set a busy timeout or a busy handler so that a reader can wait for the writer to finish the transaction. And you must take care that writers do indeed commit their transactions in a timely manner. If you are using some kind of tool (other than the SQLite Shell and the C Api) to access the database, consult the Manual for that tool.
(3) By TripeHound on 2020-03-20 11:30:53 in reply to 1 [source]
change type of column, etc.
It should also be noted that in SQLite you cannot change much of an existing table except its name, the name of existing fields, or to add new fields (see ALTER TABLE in the documentation). If you're using something that appears to offer the ability to do this (maybe some general database management program that supports many types of underlying database), then "database is locked" is perhaps its way of telling you this cannot be done in SQLite.
(4) By anonymous on 2020-03-20 16:31:31 in reply to 3 [link] [source]
It is possible to make some more kinds of changes if you are careful; you should read the documentation about the file format before attempting to do this, though.