SQLite database is locked

In my plugin, some player report me this error “org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)”. But I don’t know how to correct this. This only appears with SQLite

My class to open connection :
https://pastebin.com/urfamNCm

My class with all query:
https://pastebin.com/37UWDq6u

First off, even though you’re only doing it with config values, it is a good practice to literally never use string concatenation in an SQL query.
Anyway, if I had to guess, I’d say it’s because you’re not actually disposing of your connection objects. Use a try-with-resources statement to ensure that the connections get properly closed.

I’d suggest not to use sqlite at all.

1 Like