Closed GoogleCodeExporter closed 8 years ago
Ok; found the code that it's throwing the error on. The code executes this
block:
Connection connection = DriverManager.getConnection(p.getUrl(),
p.getUsername(), p.getPassword());
DatabaseMetaData dmd = connection.getMetaData();
if
(dmd.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED))
connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
The error is thrown on the last line while setting the isolation. So it looks
like H2 is saying UNCOMMITTED is supported; but maybe it shouldn't return true
here if it is running in MULTI_THREADED mode?
Any thoughts?
Original comment by localde...@gmail.com
on 3 Sep 2014 at 3:59
what does the exception trace look like?
Original comment by noelgrandin
on 4 Sep 2014 at 12:19
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
public class tester {
public static void main(String... args) throws Exception {
Class.forName("org.h2.Driver");
Connection connection = DriverManager.getConnection("jdbc:h2:tcp://pathToDatabase;MULTI_THREADED=TRUE;LOCK_MODE=3;", "sa", "sa");
DatabaseMetaData dmd = connection.getMetaData();
if (dmd.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED))
connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
System.out.println("done");
}//main
}//tester
############################################
Stacktrace:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: This combination of
database settings is not supported: "LOCK_MODE=0 & MULTI_THREADED"; SQL
statement:
SET LOCK_MODE ? [90021-181]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.Database.setLockMode(Database.java:2092)
at org.h2.command.dml.Set.update(Set.java:262)
at org.h2.command.CommandContainer.update(CommandContainer.java:78)
at org.h2.command.Command.executeUpdate(Command.java:254)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:345)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:159)
at java.lang.Thread.run(Thread.java:724)
at org.h2.engine.SessionRemote.done(SessionRemote.java:622)
at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:191)
at org.h2.jdbc.JdbcConnection.setTransactionIsolation(JdbcConnection.java:720)
at tester.main(tester.java:13)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
Original comment by localde...@gmail.com
on 4 Sep 2014 at 1:49
Thanks for the test case, this is fixed and will be released in 1.4.183
Original comment by noelgrandin
on 20 Oct 2014 at 7:07
Original issue reported on code.google.com by
localde...@gmail.com
on 3 Sep 2014 at 3:52