dimanche 1 mai 2016

Java SQLite in WAL mode: the database is locked

I'm using SQLite in my multithreaded application. To make sure that that won't cause problems, I've set the SQLite database to WAL mode. All threads share one connection that is never closed during runtime. I'm however, getting this error when executing a batch and I have no idea why it happens. All writes to the database are done using a singlethreadexecutor, reads are done in multiple threads.

java.sql.SQLException: database is locked 
at org.sqlite.DB.throwex(DB.java:370) 
at org.sqlite.DB.executeBatch(DB.java:302) 
at org.sqlite.PrepStmt.executeBatch(PrepStmt.java:93) 

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire