I do like the h2 database - it’s lightweight, easy to integrate, and just works… without fuss. A huge advantage is the ease at which the Camunda-engine regenerates the DB. This being a BIG deal for quick turnaround on a fresh database (the “no fuss” advantage). We can also talk about its in-memory capability.
So, without further ingratiating H2, a slight favor to request -
Can the build migrate to the h2 v1.4.x version? Reason for the request is that h2 has since moved to a new data-store naming/format convention. And, attempting to download and build the older version, something easily compatible with the engine’s current (h2-1.3.168.jar) is a little tedious… And, attempting to simply connect the h2 v1.4.x server with Camunda’s DB has a few pitfalls/annoyances - though easily correctable.
In context to the JBoss/Wildfly platform - upgrading to h2 v1.4.x and switching Camunad’s DB integration to a shared, tcp connection is straightforward. This approach then provides access to DB tools (such as eclipse, dbVisualizer, etc) while Camunda is running - avoiding the error, “db is locked by…”. And, though there are other ways around shared access without using the TCP/shared approach, not all the DB tools are copacetic.
Briefly - my workaround:
- just download the h2 v1.4.x h2 database
- start-up h2, test, etc…
Switch WildFly over to the new h2 version - shutdown the server first:
- copy the new h2 jar into the WildFly h2 modules directory
/[wildfly root directory]/modules/com/h2database/h2/main
In my context, I copied in “h2-1.4.193.jar”
- update the “modules.xml” found in the same directory
NOTE: new jar name: resource-root path=“h2-1.4.193.jar”
<module xmlns="urn:jboss:module:1.3" name="com.h2database.h2">
<resources>
<resource-root path="h2-1.4.193.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
-
I removed Camunda’s previous database - letting the BPM engine regenerate using the new h2 version.
-
Update standalone.xml with the new url
<datasource jta="true" jndi-name="java:jboss/datasources/ProcessEngine" pool-name="ProcessEngine" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:h2:tcp://centosw02//opt/wildfly-1010.camunda.camel/camunda-h2-dbs/process-engine;MVCC=TRUE</connection-url>
<driver>h2</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
- And then startup a database tool and configure - in this example the Eclipse database explorer’s JDBC connection url
jdbc:h2:tcp://centosw02//opt/wildfly-1010.camunda.camel/camunda-h2-dbs/process-engine;MVCC=TRUE