Adding a Data Source
Data source management capability is provided by the following feature in the WSO2 feature repository:
Name: WSO2 Carbon - Datasource Management Feature
Identifier: org.wso2.carbon.datasource.feature.group
A Data Source can be added with InMemory configuration or with JNDI. Follow the instructions below to add a new Data Source to a running Carbon instance.
1. Log on to the product's management console and select "Data Sources."
2. Click on the "Add Data Source" link in the "Data Sources" page.
3. Specify the required options in the "New Data Source" page.
Tip The meaning of many fields is similar to the DBCPconfiguration guide, to which you can refer for more information: http://commons.apache.org/dbcp/configuration.html |
- Name - Name of the data source (This value should be unique.)
- 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. "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 (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.
Info
The default value is 8.
- Max Idle (int) -The minimum number of connections that can remain idle in the pool without extra ones being created. It can be zero to create none.
Info
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.
Info
The default value is 8.
- Transaction Isolation - For the isolation values, please refer to the javadoc here: http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/Connection.html#field_summary
- 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.
For example,
JNDI Data Source
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.
For example,
4. Click on the "Add" button to create the new Data Source.
5. The new Data Source appears in the "Data Sources" list.
From here you can edit and delete Data Sources.