How to configure External Database for WSO2 Business Process Server

WSO2BPS (which allows you to easily deploy and manage complex BPEL services) can be configured to use external database other than the embedded Derby database as it’s persistence storage.

Lets configure External database for BPS

1. Set up and start your database server

WSO2BPS (version – 1.1.1) supports for Mysql ,Oracle and MSSQL Database server.  Latest Vesion of WSO2BPS would support for PostgreSQL.


2. Create a database

3. Extract wso2wbps-1.1.1.zip and Load the BPS schema into that database using provided SQL scripts.

(For example if you are using mysql as your database server, use mysql.sql script located inside ‘WSO2BPS/dbscripts/bps’ directory to create the BPS schema)

use command “mysql -u root -p bps < /home/asela/BPS/wso2bps-1.1.0-SNAPSHO/dbscripts/bps/mysql.sql"
 
4. Create file named ‘datasources.properties’ inside WSO2BPS/conf directory

5. Add following configuration in datasources.properties file 


Following is sample configuration for Mysql.

synapse.datasources=bpsds
synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
synapse.datasources.providerPort=2199

synapse.datasources.bpsds.registry=JNDI
synapse.datasources.bpsds.type=BasicDataSource
synapse.datasources.bpsds.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.bpsds.url=jdbc:mysql://localhost:3306/bps
synapse.datasources.bpsds.username=root
synapse.datasources.bpsds.password=asela
synapse.datasources.bpsds.dsName=bpsds
synapse.datasources.bpsds.maxActive=100
synapse.datasources.bpsds.maxIdle=20
synapse.datasources.bpsds.maxWait=10000

in first three lines, data source names, initial context factory and provider port have been configured. Here “bpsds“is used as data source name.

other lines are specified the properties for previously created database. Make sure that your database url, username and password are correctly specified.

6.Open bps.xml file inside WSO2BPS/conf directory and add following parameters


7.Copy the JDBC driver jar file into the ‘WSO2BPS/repository/components/lib’ directory

8.Then start the WSO2BPS server 

if correctly configured You will see following log in WSO2BPS startup..

[2010-05-01 17:49:56,056]  INFO –  DataSources will be registered in the JNDI context with provider PROP_URL : rmi://asela-laptop:2199
……………………………….

[2010-05-01 17:49:59,490]  INFO –  ODE using external DataSource “bpsds”.
[2010-05-01 17:49:59,491]  INFO –  Using DAO Connection Factory class: org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl
[2010-05-01 17:49:59,491]  INFO –  Using DAO Connection Factory class org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl.
[2010-05-01 17:50:00,701]  INFO –  Registering E4X Extension…
[2010-05-01 17:50:00,761]  INFO –  BPEL Server Started.
[2010-05-01 17:50:00,806]  INFO –  Starting OpenJPA 1.1.0
[2010-05-01 17:50:00,914]  INFO –  Using dictionary class “org.apache.openjpa.jdbc.sql.MySQLDictionary”.