SQLITE_BUSY The database file is locked (database is locked) in wicket

安稳与你 提交于 2019-11-27 02:06:54

Sqlite allows only one writer to the whole database at a time and, unless you selected "WAL" journal mode, no reader while writing. Moreover unless you explicitly ask it to wait, it simply returns the SQLITE_BUSY status for any attempt to access the database while conflicting operation is running.

You can tell sqlite to wait for the database to become available for specified amount of time. The C-level API is sqlite3_busy_timeout; I never used sqlite from Java though, so I don't know where to find it there.

(...) tell sqlite to wait for the database to become available for specified amount of time.

In order to do it from Java, run the following statement just like a simple SQL statement:

pragma busy_timeout=30000; -- Busy timeout set to 30000 milliseconds
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!