Versions Compared

Key

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

Data source Datasource 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

If data source datasource management capability is not included in your product by default, you can add it by installing the above feature using the instructions given in section, Feature Management. Follow the instructions below to add a new Data Source datasource to a running Carbon ESB instance.

1. Log on to the product's management console and select "In the ESB management console, click the Configure tab, and then click 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. Depending on the data source datasource type, the required fields may vary. Discussed below are the two types available.

RDBMS
Anchor
rdbms
rdbms

If you select the "Data Source Type" as RDBMS, the following screen will appear.

This is the default RDBMS data source datasource configuration provided by WSO2. Users can also write your own RDBMS configuration by selecting the Custom Data Source option. The following fields should be provided when defining the default RDBMS data sourcedatasource.

  • Data Source Type : RDBMS
  • Name : Name of the data source datasource (This value should be unique.)
  • Data Source Provider : Discussed below.
  • 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.
  • Expose as a JNDI Data Source : Discussed below.
  • Data Source Configuration Parameters : Additional properties can be defined when creating an RDBMS data sourcedatasource. For more information on these properties, refer to section Data Source see Datasource Parameters.

The meaning of many fields is similar to the DBCPconfiguration guide, to which you can refer to for more information: http://commons.apache.org/dbcp/configuration.html

4. Once After entering the values are entered, click "Save".

5. You have created a carbon data source. Also refer to You can now edit and delete Data Sourcesdatasources as needed.

Data Source
Datasource Provider
Anchor
pro
pro

There are two types of data source datasource providers. You can use the default provider or link to an external provider. For the 'default' Data Source Provider, given datasource provider, enter the connection properties Driver, URL, User Name, and Password need to be entered as follows:

If you need to add a data source datasource supported by an external provider class such as "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource", select the "external" option and enter the name and value of connection properties by clicking "Add Property". Given below Following is an example data source of External Data source Provider with entered valuesdatasource for an external datasource provider.

JNDI
Data Source
Datasource
Anchor
jndi
jndi

Java Naming and Directory Interface (JNDI) is a Java application programming interface (API) providing that provides naming and directory functionality for Java software clients to discover and look up data and objects via a name. It helps decouple object creation from the object look-up. When you have registered a data source datasource with JNDI, others can discover it through a JNDI look-up and use it.

To expose a data source datasource as a JNDI data sourcedatasource, select the "Expose as a JNDI Data Source".


Name : Name of the JNDI data source which datasource that will be visible to others in object look-up.
Use Data Source Factory : If the data source need datasource needs to be accessed from an external environment, Data Source Factory should be used. If this is selected, a Reference object will be created with the defined data source datasource properties. Then Data Source Factory will create the data source instancebased datasource instance based on the values of the Reference object when accessing the data source datasource from an external environment. In the configuration, this is set as useDataSourceFactory="true".
JNDI Properties : Properties related to the jndi data source (Password etcJNDI datasource (such as password). If Use Data Source Factory is selected, the following properties should be specified.:
        java.naming.factory.initial -This property is used to select the registry service provider as the initial context.
        java.naming.provider.url - This property specifies the location of the registry when the registry is being used as the initial context. 

Custom

Data Source 

Datasource 
Anchor
custom
custom

If you select the "Data Source Type" as Custom, the following screen will appear.


  • Data Source Type : Custom 
  • Custom Data Source Type : Described below.
  • Name : Name of the data source datasource (This value should be unique)
  • Description : Description of the data sourcedatasource
  • Configuration : XML configuration of the data sourcedatasource
Custom
Data Source
Datasource Type 
Anchor
CusDSType
CusDSType

The actual type of the custom data source datasource can be either "DS_CUSTOM_TABULAR" or "DS_CUSTOM_QUERY". There are two options cover most of the common business use cases.  

Custom Tabular Data SourcesDatasources   

Tabular data sources datasources are used when there is a data source which datasource that represents its data using tables, where a set of named tables contains data rows that can be queried later.  

To implement tabular data sourcesdatasources, the interface "org.wso2.carbon.dataservices.core.custom.datasource.TabularDataBasedDS" is used. A sample implementation of tabular custom data source datasource can be found at InMemoryDataSource. 

A tabular data source datasource is typically associated with an a SQL data services query. This is done by internally using our own SQL parser to execute SQL against the custom data sourcedatasource. A sample data service dataservice descriptor on how this is done can be found at InMemoryDSSample. Also, this is supported in Carbon data sourcesdatasources, with the data source datasource reader implementation "org.wso2.carbon.dataservices.core.custom.datasource.CustomTabularDataSourceReader". A sample Carbon data source datasource configuration file can be found at <CARBON_HOME>\repository\conf\datasources\custom-datasources.xml.

Custom Query Data SourcesDatasources   

Custom query-based data sources datasources are created when there is a data source which datasource that has some form of a query expression support.

To implement, the interface "org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryBasedDS" is used. Any non-tabular data source datasource can be created using the query-based approach. Even if the target data source datasource does not have a query expression format, users can create their own and it. For example, any NoSQL type data source datasource can be supported using this type of a data sourcedatasource.  

A sample implementation of a query-based custom data source datasource can be seen at EchoDataSource. A sample data service descriptor with custom query data sources datasources can be found in action in InMemoryDSSample. This is supported in Carbon data sourcesdatasources, with the data source datasource reader implementation org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryDataSourceReader. A sample of a Carbon data source datasource configuration file can be found at <CARBON_HOME>\repository\conf\datasources\custom-datasources.xml.  

In the "init" methods of all custom data sourcesdatasources, user-supplied properties will be parsed to initialize the data source datasource accordingly. Also, a property named "__DATASOURCE_ID__", which contains a UUID to uniquely identify the current data sourcedatasource, will be passed. This can be used by custom data source datasource authors to identify the data sources datasources accordingly. For example, scenarios like data source datasource instances communicating within a server cluster for data synchronization.

Shown below is an example configuration of a custom data source datasource of type 'DS_CUSTOM_TABULAR'.


4. Once After entering the values are entered, click "Save".

5. You have created a carbon data source. Also refer to You can nowedit and delete Data Sources .

Excerpt
hiddentrue
Instructions to add a RDBMS or custom data source to WSO2 products.

datasources as needed.