I've found a bug when enabling shared cache mode in version 056 of the sqlitejdbc driver. According to this sqlite page, there are 2 ways to enable shared cache mode.
http://www.sqlite.org/sharedcache.html 1. You can use sqlite3_enable_shared_cache() which effects subsequent database connections within the same process. 2. You can pass a flag to sqlite3_open_v2() The sqlitejdbc driver uses sqlite3_enable_shared_cache(), but it only calls it AFTER the connection has been made. You can see this in Conn.java. This causes the following weird behavior: 1. The first connection for a process will never have shared cache enabled. 2. Subsequent connections will use the shared_cache settings of the previous connection. 3. If two threads make connections near the same time, there could be weird race conditions involving the shared cache setting. If a user of sqlitejdbc does the following for each connection, they can work around symptom 1 and 2: conn = driver.connect(connectionURL, props); conn.close(); conn = driver.connect(connectionURL, props); Since the sqlitejdbc driver's API only allows you to set shared_cache on a per-connection basis, I think it should enable shared cache within sqlite by passing a flag to the sqlite3_open_v2() function. This should fix all of the problems. Using this method should also allow the NestedVM driver to also use shared cache as well. So my next question is, how active is this project? Is anyone still active on this mailing list that can fix the problem? I'm willing to write a patch if necessary. Just let me know. Thanks, Brian Vincent _______________________________________________ SQLiteJDBC mailing list [email protected] https://lists.hcoop.net/listinfo/sqlitejdbc
