The situation: after a db import with the suggested (persistent) setting 
LOCK_MODE=0, connecting to the same or another db with the global setting 
MULTI_THREADED=1 fails.
One needs to reset the lock mode with LOCK_MODE=3.

This has been noted by 
https://groups.google.com/forum/#!msg/h2-database/chvHwUZ20xQ/sYgNWLVSUXQJ and 
it's the only place after 2 hrs of searching where I've found the solution.

The reason why I did not solve this quicker is because in my setup, I got 
an SQLException from sqlite instead:

java.sql.SQLException: invalid database address: jdbc:h2:file:c:/h2tempdb;
IFEXISTS=TRUE;ACCESS_MODE_DATA=r;MULTI_THREADED=1
    at org.sqlite.JDBC.createConnection(JDBC.java:110)
    at org.sqlite.JDBC.connect(JDBC.java:87)
    at java.sql.DriverManager.getConnection(DriverManager.java:579)
    at java.sql.DriverManager.getConnection(DriverManager.java:243)
    at 
com.optimaize.labs.dbperf.databases.h2.ConnectionTest.run(ConnectionTest.java:54)
    at 
com.optimaize.labs.dbperf.databases.h2.ConnectionTest.thisFails(ConnectionTest.java:26)

It seems that this happens when I have 2 sql drivers. Java asks each, all 
report they can't handle this connection string, and the last one (sqlite) 
throws this.
I've created a short reproducible test case here: 
https://github.com/fabiankessler/readonly-embedded-dbs-benchmark/blob/master/src/test/java/com/optimaize/labs/dbbench/databases/h2/ConnectionTest.java
 


Also, I'm wondering why LOCK_MODE=0 is not acceptable when my connection is 
ACCESS_MODE_DATA=r.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to