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, WSO2_CARBON_DB datasource is configured in the master-datasources.xml file for the purpose of connecting to the default  H2 database, which stores registry and user management data. 

After setting up the MySQL database to replace the default H2 database, either change the default configurations of the WSO2_CARBON_DB datasource, or configure a new datasource to point it to the new database as explained below.

Follow the steps below to change the type of the default WSO2_CARBON_DB datasource 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 for the BPEL database

Follow the steps below.

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

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

    Localtabgroup
    Localtab
    titleMySQL
    <datasource>
    Code Block
    languagehtml/xml
    html/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>
              <name>WSO2_CARBON_DB</name>  <minIdle>5</minIdle>
         <description>The datasource used for registry and user manager<<testOnBorrow>true</description>testOnBorrow>
            <jndiConfig>    <validationQuery>SELECT 1 FROM DUAL</validationQuery>
        <name>jdbc/WSO2CarbonDB</name>        <<validationInterval>30000</jndiConfig>validationInterval>
             <definition type="RDBMS">  <username>scott</username>
             <configuration>   <password>tiger</password>
                <url>jdbc:mysql://localhost:3306/regdb</url><defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         <username>regadmin<</username>
    definition>
    </datasource>
    Localtab
    titleIBM
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
      <password>regadmin</password>        <name>WSO2MBStoreDB</name>
         </jndiConfig>
     <driverClassName>com.mysql.jdbc.Driver</driverClassName>    <definition type="RDBMS">
             <configuration>
    <maxActive>80</maxActive>            <driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
       <maxWait>60000</maxWait>         <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
          <minIdle>5</minIdle>      <maxActive>100</maxActive>
             <testOnBorrow>true</testOnBorrow>   <maxWait>60000</maxWait>
                <validationQuery>SELECT 1<<minIdle>5</validationQuery>minIdle>
                <testOnBorrow>true</testOnBorrow>
       <validationInterval>30000</validationInterval>         <validationQuery>SELECT 1 FROM <DUAL</configuration>validationQuery>
           </definition> </datasource>
    Localtab
    titleMS SQL
    Code Block
    languagexml
    <datasource>    <name>WSO2_MB_STORE_DB</name>
       <jndiConfig><validationInterval>30000</validationInterval>
            <name>WSO2MBStoreDB</name>    <<username>scott</jndiConfig>username>
       <definition type="RDBMS">        <password>tiger</password>
     <configuration>           <defaultAutoCommit>false</defaultAutoCommit>
             <url>jdbc:jtds:sqlserver://localhost:1433/wso2_mb</url></configuration>
         </definition>
    </datasource>
    Localtab
    titleDerby
    Code Block
    languagexml
    <datasource>
         <name>WSO2_MB_STORE_DB</name>
         <jndiConfig>
        <username>sa</username>     <name>WSO2MBStoreDB</name>
         </jndiConfig>
         <definition type="RDBMS">
      <password>sa</password>       <configuration>
                 <driverClassName>com<driverClassName>oracle.microsoftjdbc.sqlserverdriver.jdbc.SQLServerDriver<OracleDriver</driverClassName>
                <url>jdbc:oracle:thin:@localhost:1521/orcl</url>
                <maxActive>200<<maxActive>100</maxActive>
        
                   <maxWait>60000</maxWait>
           
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
           <testOnBorrow>true</testOnBorrow>     <validationQuery>SELECT 1 FROM DUAL</validationQuery>
                <validationQuery>SELECT 1<<validationInterval>30000</validationQuery>validationInterval>
                <username>scott</username>
           <validationInterval>30000</validationInterval>     <password>tiger</password>
                   <defaultAutoCommit>false</defaultAutoCommit>
             </configuration>
         </definition>
    </datasource>         
    Localtab
    titleOraclePostgreSQL
    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.

...