WSO2 BAM supports four different databases.

  1. H2(embedded)
  2. MySQL
  3. MsSQL
  4. Oracle

Configuration

To configure the datasource update WSO2BAM_HOME/repository/conf/datasources.properties file accordingly. (Also You can use datasources ui to edit the datasources.properties file.)
Sample configuration for a h2 datasource is as follows.

		synapse.datasources=bamh2
		synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
		synapse.datasources.providerPort=2199
		synapse.datasources.bamh2.registry=JNDI
		synapse.datasources.bamh2.type=BasicDataSource
		synapse.datasources.bamh2.driverClassName=org.h2.Driver
		synapse.datasources.bamh2.url=jdbc:h2:repository/database/WSO2BAM_DB
		synapse.datasources.bamh2.username=wso2bam
		synapse.datasources.bamh2.password=wso2bam
		synapse.datasources.bamh2.dsName=bam_datasource
		synapse.datasources.bamh2.maxActive=100
		synapse.datasources.bamh2.maxIdle=20
		synapse.datasources.bamh2.maxWait=10000
	

BAM Datasource UI



Change the driverClassName, url, username, password and validation query (optional) according to the required database configurations.

  1. For MySQL,

    To create BAM database find the relevant database script(bam_schema_mysql.sql) at WSO2BAM_HOME/dbscripts/bam and run the script to create MySQL BAM tables.
  2. For MsSQL,

    Find the relevant database script(bam_schema_mssql.sql) at WSO2BAM_HOME/dbscripts/bam and run the script to create MsSQL BAM tables.
  3. For oracle,

    Find the relevant database script(bam_schema_oracle.sql) at WSO2BAM_HOME/dbscripts/bam and run the script to create oracle BAM tables.

Note:- Registry DB and BAM DB are independent to each other. User can manage both databases in two different database servers.

Alternatively it is possible to use -Dsetup parameter at BAM server startup time to create BAM database tables given that the database has been already created with necessary permissions in place. (with those mentioned in datasources.properties file).

e.g:

 sh wso2server.sh -Dsetup 

Note:- This will not drop tables and recreate them if BAM tables are already present in the database. If this is required it may be done using a database client tool for the respective database and manually running the appropriate script mentioned above for the particular database.