After reading the Sqlite documentation I wanted to make sure that by run-time the connection to the database is in the correct mode.
Class.forName("org.sqlite.JDBC");
Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:");
I'm using the Sqlite JDBC driver. How can I add the SQLITE_OPEN_NOMUTEX flag?
解决方案
After I had some doubts why in C it looks so easy and in Java it should not possible, here probably the solution:
Class.forName("org.sqlite.JDBC");
SQLiteConfig config = new SQLiteConfig();
config.setOpenMode(SQLiteOpenMode.READWRITE);
config.setOpenMode(SQLiteOpenMode.CREATE);
config.setOpenMode(SQLiteOpenMode.NOMUTEX);
Connection connection = DriverManager.getConnection( //
"jdbc:sqlite::memory:", //
config.toProperties() //
);