mvcc

807 views
Skip to first unread message

Rami Ojares

unread,
Dec 20, 2010, 5:22:34 PM12/20/10
to h2-da...@googlegroups.com
Hi,

I switched back from multithreaded to mvcc because multithreaded was
causing too many deadlocks.
But I have a problem.
In my startup script I first start the server and after that try to make
a connection to the database
with an url that has mvcc=true.
This is never succesful however because mu applications have connection
pools that always connect
to the database before my connection in the startup script.
And because the first connection decides whether the database is to be
mvcc or not I am incapable
to ever set the database to mvcc.

Is there a way to set the database to use mvcc before allowing any
connections to it?

- rami

Thomas Mueller

unread,
Dec 26, 2010, 4:18:37 AM12/26/10
to h2-da...@googlegroups.com
Hi,

> Is there a way to set the database to use mvcc before allowing any
> connections to it?

No. The setting MVCC=TRUE needs to be set in the database URL.

Regards,
Thomas

Dario Fassi

unread,
Dec 27, 2010, 12:55:05 PM12/27/10
to h2-da...@googlegroups.com
Hi Rami,

I don't understand why you can't setup your connection pool with a url that has mvcc=true as part of it.

regards,
Dario

El 20/12/10 19:22, Rami Ojares escribi�:

bgillis

unread,
Jan 19, 2011, 8:40:41 AM1/19/11
to H2 Database
Hi guys,

I have exactly the same issue as Rami :-(

The application gets its connections from a pooled datasource (Apache
DBCP).

The datasource is configured as followed through Spring Framework.

<bean id="dataSource"
class="org.apache.commons.dbcp.managed.BasicManagedDataSource"
destroy-method="close">
<property name="transactionManager" ref="transactionManager" />
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost:9092/
jbpm4;MVCC=TRUE" />
<property name="username" value="admin" />
<property name="password" value="admin" />
<property name="maxActive" value="10" />
<property name="maxIdle" value="10" />
<property name="maxWait" value="60000" />
<property name="validationQuery" value="select * from dual" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="60000" />
</bean>

H2 is first started in Server Mode (localhost:9092).

Then as soon as I start my application I get the following exception:

org.h2.jdbc.JdbcSQLException: Cannot change the setting "MVCC" when
the database is already open; SQL statement:
SET MVCC TRUE [90133-147]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.command.dml.Set.update(Set.java:259)
at org.h2.command.CommandContainer.update(CommandContainer.java:69)
at org.h2.command.Command.executeUpdate(Command.java:201)
at org.h2.engine.Engine.openSession(Engine.java:181)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:137)
at org.h2.engine.Engine.createSession(Engine.java:120)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:124)
at java.lang.Thread.run(Thread.java:662)
at org.h2.engine.SessionRemote.done(SessionRemote.java:543)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:109)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:376)
at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:
271)
at org.h2.engine.SessionRemote.createSession(SessionRemote.java:265)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:
38)
at
org.apache.commons.dbcp.managed.LocalXAConnectionFactory.createConnection(LocalXAConnectionFactory.java:
62)
at
org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory.makeObject(PoolableManagedConnectionFactory.java:
103)
at
org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:
1556)
at
org.apache.commons.dbcp.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:
196)
... 63 more

I'm currently using H2 1.2.147 with Sun JDK 1.6.0_23 on Windows XP SP3
32bit.

Any help to solve this issue ?

Regards,
Bertrand

Thomas Mueller

unread,
Jan 24, 2011, 2:53:40 PM1/24/11
to h2-da...@googlegroups.com
Hi,

> <property name="url" value="jdbc:h2:tcp://localhost:9092/
> jbpm4;MVCC=TRUE" />

> org.h2.jdbc.JdbcSQLException: Cannot change the setting "MVCC" when


> the database is already open; SQL statement:
> SET MVCC TRUE [90133-147]

Well, that means the database is already open using a different
database URL (without the MVCC setting, or with the setting set to
false). Why?

Regards,
Thomas

bgillis

unread,
Jan 25, 2011, 10:13:44 AM1/25/11
to H2 Database
Thanks Thomas.

That's exactly the conclusion I came to ;-)

Bertrand

On Jan 24, 8:53 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:

Thomas Mueller

unread,
Jan 25, 2011, 2:36:50 PM1/25/11
to h2-da...@googlegroups.com
Hi,

> That's exactly the conclusion I came to ;-)

Is it working now?

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages