Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A datasource is used to establish the connection to a database. By default, datasource connections for the BPEL and BPMN databases are configured in the activiti-datasources.xml and bps-datasources.xml files respectively. These datasource configurations point to the default  H2 databases, which are shipped with the product. After setting up new databases to replace the default H2 databases, you can either change the default configurations in the above-mentioned files or configure new datasources.

Creating the datasource connection the datasource connection for the BPEL database

Follow the steps below.

  1. Open the <EI_HOME>/wso2/business-process/conf/datasources/bps-datasources.xml file and locate the locate the <datasource> configuration element configuration element.

  2. You simply have to update the url pointing the url pointing to your database, the username and the username and password required to access the database and the driver details as shown below.

    Localtabgroup
    Localtab
    titleMySQL
    Code Block
    languagehtml/xml
    <datasource>
           <name>WSO2_CARBON_DB</name>
           <description>The datasource used for registry and user manager</description>
           <jndiConfig>
               <name>jdbc/WSO2CarbonDB</name>
           </jndiConfig>
           <definition type="RDBMS">
               <configuration>
                   <url>jdbc:mysql://localhost:3306/regdb</url>
                   <username>regadmin</username>
                   <password>regadmin</password>
                   <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                   <maxActive>80</maxActive>
                   <maxWait>60000</maxWait>
                   <minIdle>5</minIdle>
                   <testOnBorrow>true</testOnBorrow>
                   <validationQuery>SELECT 1</validationQuery>
                   <validationInterval>30000</validationInterval>
               </configuration>
           </definition>
    </datasource>
    Localtab
    titleMS SQL
    Code Block
    languagexml
    <datasource>
       <name>WSO2_MB_STORE_DB</name>
       <jndiConfig>
           <name>WSO2MBStoreDB</name>
       </jndiConfig>
       <definition type="RDBMS">
             <configuration>
                        <url>jdbc:jtds:sqlserver://localhost:1433/wso2_mb</url>
                        <username>sa</username>
                        <password>sa</password>
                        <driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClassName>
                        <maxActive>200</maxActive>
                        <maxWait>60000</maxWait>
                        <minIdle>5</minIdle>
                        <testOnBorrow>true</testOnBorrow>
                        <validationQuery>SELECT 1</validationQuery>
                        <validationInterval>30000</validationInterval>
                        <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>         
    Localtab
    titleOracle
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titleIBM
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titleDerby
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titlePostgreSQL
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
  3. Optionally, you can update the configuration elements given below for your database connection.

    ElementDescription
    urlThe URL of the database. The default port for MySQL is 3306
    username and passwordThe name and password of the database user
    driverClassNameThe class name of the database driver
    maxActiveThe maximum number of active connections that can be allocated at the same time from this pool. Enter any negative value to denote an unlimited number of active connections.
    maxWaitThe maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. You can enter zero or a negative value to wait indefinitely.
    minIdleThe minimum number of active connections that can remain idle in the pool without extra ones being created, or enter zero to create none.

    testOnBorrow  

    The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and another attempt will be made to borrow another.
    validationQueryThe SQL query that will be used to validate connections from this pool before returning them to the caller.
    validationIntervalThe indication to avoid excess validation, and only run validation at the most, at this frequency (time in milliseconds). If a connection is due for validation but has been validated previously within this interval, it will not be validated again.
    Info

    For more information on other parameters that can be defined in the <EI_HOME>/wso2/broker/conf/datasources/ master-datasources.xml file, see Tomcat JDBC Connection Pool.

Updating other configuration files

...

Creating the datasource connection for the BPMN database

Follow the steps below.

  1. Open the <EI_HOME>/wso2/

    broker

    business-process/conf/datasources/

    broker

    activiti-datasources.xml

     file. This is the root configuration file of the EI Message Broker profile. The changes made to this file must be done in all the broker nodes.

    In the broker.xml file we need to use the Oracle message store and Andes context store. To do this, uncomment or add the following configuration.

    Code Block
    languagexml
    ... <messageStore class="org.wso2.andes.store.rdbms.RDBMSMessageStoreImpl">

     file and locate the <datasource> configuration element.

  2. You simply have to update the url pointing to your database, the username and password required to access the database and the driver details as shown below.

    Localtabgroup
    Localtab
    titleMySQL
    Code Block
    languagehtml/xml
    <datasource>
           <name>WSO2_CARBON_DB</name>
         
    <property
     
    name="dataSource">WSO2MBStoreDB</property> </messageStore> <andescontextStore class="org.wso2.andes.store.rdbms.RDBMSAndesContextStoreImpl">
     <description>The datasource used for registry and user manager</description>
           
    <property name="dataSource">WSO2MBStoreDB</property> </andescontextStore>

    The elements in the above configuration are described below.

  3. The fully qualified name of the respective implementation class should be defined under the class attributes of messageStore and andesContextStore elements. This implementation class will be used by the broker to persist relevant information.

  4. The <property> elements are used to define different properties for each store. The minimal property for starting each store is the dataSource property. Depending on the implementation, the required properties may differ
    <jndiConfig>
               <name>jdbc/WSO2CarbonDB</name>
           </jndiConfig>
           <definition type="RDBMS">
               <configuration>
                   <url>jdbc:mysql://localhost:3306/regdb</url>
                   <username>regadmin</username>
                   <password>regadmin</password>
                   <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                   <maxActive>80</maxActive>
                   <maxWait>60000</maxWait>
                   <minIdle>5</minIdle>
                   <testOnBorrow>true</testOnBorrow>
                   <validationQuery>SELECT 1</validationQuery>
                   <validationInterval>30000</validationInterval>
               </configuration>
           </definition>
    </datasource>
    Localtab
    titleMS SQL
    Code Block
    languagexml
    <datasource>
       <name>WSO2_MB_STORE_DB</name>
       <jndiConfig>
           <name>WSO2MBStoreDB</name>
       </jndiConfig>
       <definition type="RDBMS">
             <configuration>
                        <url>jdbc:jtds:sqlserver://localhost:1433/wso2_mb</url>
                        <username>sa</username>
                        <password>sa</password>
                        <driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClassName>
                        <maxActive>200</maxActive>
                        <maxWait>60000</maxWait>
                        <minIdle>5</minIdle>
                        <testOnBorrow>true</testOnBorrow>
                        <validationQuery>SELECT 1</validationQuery>
                        <validationInterval>30000</validationInterval>
                        <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>         
    Localtab
    titleOracle
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titleIBM
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titleDerby
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
    Localtab
    titlePostgreSQL
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
             <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
             <configuration>
                <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>100</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationInterval>30000</validationInterval>
                <username>scott</username>
                <password>tiger</password>
                <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>
  5. Optionally, you can update the configuration elements given below for your database connection.

    ElementDescription
    urlThe URL of the database. The default port for MySQL is 3306
    username and passwordThe name and password of the database user
    driverClassNameThe class name of the database driver
    maxActiveThe maximum number of active connections that can be allocated at the same time from this pool. Enter any negative value to denote an unlimited number of active connections.
    maxWaitThe maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. You can enter zero or a negative value to wait indefinitely.
    minIdleThe minimum number of active connections that can remain idle in the pool without extra ones being created, or enter zero to create none.

    testOnBorrow  

    The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and another attempt will be made to borrow another.
    validationQueryThe SQL query that will be used to validate connections from this pool before returning them to the caller.
    validationIntervalThe indication to avoid excess validation, and only run validation at the most, at this frequency (time in milliseconds). If a connection is due for validation but has been validated previously within this interval, it will not be validated again.
    Info

    For more information on other parameters that can be defined in the <EI_HOME>/wso2/broker/conf/datasources/ master-datasources.xml file, see Tomcat JDBC Connection Pool.

Creating database tables

To create the database tables, connect to the database databases that you created earlier and run the following scripts: scripts provided in the product pack.

Creating database tables in the BPEL database 

Localtabgroup
Localtab
titleMySQL

To create the database tables, connect to the database that you created earlier and run the following scripts.

  1. To create tables in the broker-specific BPEL database (WSO2BPS_MBDS), use the below script:

    Info

     You may have to enter the password for each command when prompted.

    Code Block
    languagepowershell
    mysql -u root -p -DWSO2DBPS_MBDS < '<WSO2MB<EI_HOME>/wso2/business-process/dbscripts/bps/mb-store/mysql-mb.sqlbpel/...... ';
  2. Restart the server.

    Info

    You can create database tables automatically when starting the product for the first time by using the -Dsetup parameter as follows:

    • For Windows: <EI_HOME>/wso2/broker/bin/wso2server.bat -Dsetup

    • For Linux: <EI_HOME>/wso2/broker/bin/wso2server.sh -Dsetup

Localtab
titleMS SQL

To create the database tables, connect to the database that you created earlier and run the following scripts.

  1. To create tables in the broker-specific B database (wso2mb), use the below script:

    Code Block
    <EI_HOME>/wso2/broker/dbscripts/mb-store/mssql-mb.sql
  2. Restart the server.

    Info

    You can create database tables automatically when starting the product for the first time by using the -Dsetup parameter as follows:

    • For Windows: <EI_HOME>/wso2/broker/bin/wso2server.bat -Dsetup

    • For Linux: <EI_HOME>/wso2/broker/bin/wso2server.sh -Dsetup

Localtab
titleOracle

To create the database tables, connect to the database that you created earlier and run the following scripts in SQL*Plus:

  1. To create tables in the broker-specific database, use the below script:

    Code Block
    languagepowershell
    SQL> @$<EI_HOME>/wso2/broker/dbscripts/mb-store/oracle-mb.sql
  2. Restart the server.

    Info

    You can create database tables automatically when starting the product for the first time by using the -Dsetup parameter as follows:

    • For Windows: <EI_HOME>/wso2/broker/bin/wso2server.bat -Dsetup

    • For Linux: <EI_HOME>/wso2/broker/bin/wso2server.sh -Dsetup

...