Reputation: 7255
I am using sqlite as the database of an application.It works fine on everything but when i am going to delete a table from the database then it throws this error using [https://bitbucket.org/xerial/sqlite-jdbc]:
Error
java.sql.SQLException: [SQLITE_LOCKED] A table in the database is locked (database table is locked)
I am using no-auto-commit-mode so before deleting the table i had already committed.Why this is happening?
A possible solution is to close the connection and re-open it but this can't be done because other actions are taking place simultanesouly.
**
**
I was counting the rows of a table into a thread using:
connection1.createStatement().executeQuery("SELECT COUNT(*) FROM LIBRARIES;").getInt(1);
but this returns a result set which was never closed so the database table was forever locked!!
Upvotes: 0
Views: 279