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 build.properties file:
#H2.version=1.3.168 #db.name=h2 #db.driver.jar.name=h2-${H2.version}.jar #db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar #postgresql db.name=postgresql db.driver.module.prefix=org/postgresql db.driver.jar.name=postgresql-9.1-902.jdbc4.jar db.driver.download.url=https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar
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"> <resources> <resource-root path="postgresql-9.1-902.jdbc4.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
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"> <datasources> <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="PostgreDS" enabled="true" use-java-context="true" use-ccm="true"> <connection-url>jdbc:postgresql://localhost/jbpm</connection-url> <driver>postgresql</driver> <security> <user-name>postgres</user-name> <password>postgres</password> </security> </datasource> <drivers> <driver name="postgresql" module="org.postgresql"> <xa-datasource-class>org.postgresql.Driver</xa-datasource-class> </driver> </drivers> </datasources> </subsystem>
Now execute the full installer and you are done!
$ ant install.demo