Saturday, January 17, 2009

Data source configuration in jBPM 3.2

Starting from version 3.2.4, jBPM is distributed as a Java-based installer for easy product setup. The installer lets you fill in the following parameters.

1. Installation directory
2.
Components to be installed (see screenshot)

  • Standalone
  • JBoss integration
  • Optional Eclipse / JBoss AS downloads
3. Target database
4. JBoss AS directory, if you already have one


The target database selection currently includes HSQLDB, MySQL and Sybase, with PostgreSQL, Oracle and MS SQL underway. Selecting a database is as simple as clicking your choice in the appropriate screen. Configuring jBPM with the appropriate parameters for your database is slightly trickier. This post will guide you though it.

The installer will put the jBPM enterprise components in the deploy/jbpm directory of your server profile. You will find a jbpm-database-ds.xml file there, where database corresponds to your selection in the installer, of course. Let us take MySQL as example. The contents of the installed file are listed below.

<xa-datasource>
<jndi-name>JbpmDS</jndi-name>

<xa-datasource-class>
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
<xa-datasource-property name="ServerName">
localhost
</xa-datasource-property>
<xa-datasource-property name="PortNumber">
3306
</xa-datasource-property>
<xa-datasource-property name="DatabaseName">
jbpmtest
</xa-datasource-property>
<user-name>jbpmtest</user-name>
<password></password>
...
</xa-datasource>
You will probably want to edit the server name, database name, user name and password before launching JBoss AS, otherwise you will get database connectivity exceptions. The remaining settings have worked for us in our test environment and are our general recommendations. In case you want to further tune the data source, the available settings are documented in the JBoss AS configuration guide.

Apart from the data source, the installer places the JDBC driver of the target database in the deploy/jbpm/jbpm-service.sar directory, provided that the driver is freely distributable. Otherwise, you will need to obtain and install the driver yourself, according to the instructions provided in Appendix B of the aforementioned guide. Free open source database users have it easiest, which is only fair :-)

2 comments:

Kukeltje said...

A small addtition from my side: Make sure that with MySQL, you use the 5.1.7 driver. The 5.1.6 one gave me and others weird errors.

Alejandro said...

What errors? We should probably bump the MySQL driver version in the POM file.