I am using SQLite DB and I have multiple threads using a single connection. As per https://www.sqlite.org/threadsafe.html I think I need to use serialized mode.
How can I set threading mode in Java? I mean method?
SQLiteConfig config = new SQLiteConfig();
config.setOpenMode(SQLiteOpenMode.FULLMUTEX);
dbc = DriverManager.getConnection(jdbcPath,config.toProperties());
Is there any relation between SQLiteOpen mode and Threading Mode ?
SQLite supports three different threading modes:
Single-thread. In this mode, all mutexes are disabled and SQLite is unsafe to use in more than a single thread at once.
Multi-thread. In this mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.
Serialized. In serialized mode, SQLite can be safely used by multiple threads with no restriction.