This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Adding a Data Source

A Data Source can be added with InMemory configuration or with JNDI.

Follow the instructions below to add a new Data Source in WSO2 ESB.

1. Sign in. Enter your user name and password to log on to the ESB Management Console.

2. From the left navigation menu, select "Data Sources."

3. Click on the "Add Data Source" link in the "Data Sources" page.

4. Specify the required options in the "New Data Source" page.

  • Name - Name of the data source (This value should be unique.)
  • Data Source Name - A name to identify the data source if a value is not specified.
  • Driver - The JDBC driver to be used.
  • URL - The connection URL to be passed to the JDBC driver to establish a connection.
  • User Name - The connection user name to be passed to the JDBC driver to establish a connection.
  • Password - The connection password to be passed to the JDBC driver to establish a connection.
  • Data Source Pool Implementation - The type of the data source pool implementation. The "Pool Type" can be either:
    • BasicDataSource - This data source is an implementation of javax.sql.DataSource that is configured via Java Bean properties.
    • PerUserPoolDataSource - This data source uses individual pools per user. Some properties can be set specifically for a given user if the deployment environment can support initialization of mapped properties. For example, a pool of admin or write-access Connections can be guaranteed a certain number of connections that are separate from a maximum set for users with read-only connections.
  • Repository Type - The type of the data source repository.
    • InMemory
    • JNDI
  • Max Active - The maximum number of active connections that can be allocated from this pool at the same time. If a negative value is specified, there will not be a limit to the number of connections.

    Tip

    The default value is 8.

  • Max Idle -The minimum number of connections that can remain idle in the pool without extra ones being created. It can be zero to create none.

    Tip

    The default value is 8.

  • Initial Size (int) - The initial number of connections that are created when the pool is started.
  • Max Open Statements (int) - The maximum number of active connections that can be allocated from this pool at the same time. If a negative value is specified, there will not be a limit to the number of connections.

    Tip

    The default value is 8.

  • Transaction Isolation - For the isolation values, please refer to the javadoc.
  • Auto Commit - The default auto-commit state of connections created by this pool.
  • Pool Statements - Enables prepared statement pooling for this pool.

    Tip

    The default value is "False."

  • Test On Borrow - Indicates 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 we will attempt to borrow another.

    Tip

    The default value is "True." For the value "True" to have any effect, the validationQuery parameter must be set to a non-null string.

  • Test While Idle - Indicates whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.

    Tip

    The default value is "False." For the value "True" to have any effect, the validationQuery parameter must be set to a non-null string.

  • Validation Query - The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query must be an SQL "SELECT" statement that returns at least one row.

Special options of the JNDI configuration:

  • IC Factory - Initial context factory of the JNDI.
  • Provider Port - If specified, it will be used to create a JNDI provider URL internally.
  • Provider URL - The URL of the JNDI provider. It is assumed that this URL exists and is accessible.

5. Click on the "Add" button to create a new Data Source.