Configuring jBPM 6 to use a non-default Database

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

The jBPM 6 full installer out of the box ships with the H2 Database for saving the Process Persistence data. Besides H2, there is already included a file db/mysql_module.xml which is a template for configuring MySQL as Database. In this tutorial have have described how to configure the installer to use MySQL database: Introduction to jBPM 6

Configuring jBPM 6 with PostgreSQL database

If you are using another Database such as PostgreSQL then you have a couple of additional steps. First of all, before launching the full installer to use PostgreSQL, configure the file:



As you can see, we have commented the default H2 database and uncommented the postgresql section.

Now move to the db folder and create a file named: postgresql_module.xml:

<module xmlns="urn:jboss:module:1.0" name="com.postgres">
     <resource-root path="postgresql-9.1-902.jdbc4.jar"/>

      <module name="javax.api"/>
      <module name="javax.transaction.api"/>

This file is the module declaration for the JDBC Driver that will be imported in the application server.

Next, still in the db folder, edit the file jbpm-persistence-JPA2.xml so that the PostgreSQL dialect is specified:

   <!--   <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />-->
 <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

Finally, in the application server configuration file (default standalone-full-wildfly-8.2.1.Final.xml ), you will need declaring the Datasource definition:

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
        <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="PostgreDS" enabled="true" use-java-context="true" use-ccm="true">
            <driver name="postgresql" module="org.postgresql">

  This step can be executed as well after the installation is completed. In this latter case you will need to modify the resulting configuration file (e.g. standalone-full.xml).

Now execute the full installer and you are done!

$ ant install.demo