Versions Compared

Key

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

A datasource provides information that a server can use to connect to a database or to an external data store. For example, all WSO2 products are shipped with the wso2carbon.h2 database, and the datasource that is used to connect to this database is defined in the master-datasources.xml files stored in the <PRODUCT_HOME>/repository/conf/datasources/ directory. You can also create your own custom datasources by creating a configuration file and storing it in the same <PRODUCT_HOME>/repository/conf/datasources/ folder. For example, see the custom-datasources.xml file stored in this folder. If the datasource management feature is included your product, you can also manage datasources using the management console. If this feature is not included in your product by default, you can install the following using the instructions given under the Feature Management section of this documentationThe topics given below explain the ways in which new datasources can be created and edited in WSO2 products.

Info
titleDatasources for data services and resources:

Datasources created using the management console as explained below can later be used for defining data services. When defining data services, you also have the option of using the common datasources such as Excel, CSV etc., in addition to RDBMS and custom datasource. See the documentation on generating data services using a given database structure and creating data services using various datasources for more information.

Table of Contents
maxLevel3
minLevel3

Creating datasources using the management console

The following feature in the WSO2 Feature Repository allows you to manage datasources using the management console of your product:

Name: WSO2 Carbon - datasource management feature 
Identifier: org.wso2.carbon.datasource.feature.group

If this feature is not included in your product by default, you can install it using the Feature Management section of this documentation. With this feature, you can define add any RDBMS datasource , which can be used to connect to a database/external data store, or you can define your own custom datasources . New datasources can be added to your product using the management console, which can later be later edited and or deleted for your product instance if required. Note that all datasources created using the management console are saved to the registry of your product. See the  The steps for creating and modifying datasource information:

Table of Contents
maxLevel3
minLevel3

Creating datasources using the management console

Use the following steps to add a datasource:

  1. In the product management console, click Data Sources on the Configure tab. 
    Image Removed  
  2. Click Add Data Source.  
  3. Specify the required options for connecting to the database. The available options are based on the type of datasource you are creating:
    Child pages (Children Display)

...

hiddentrue

...

datasources are discussed in the following topics:

Child pages (Children Display)

Creating datasources using configuration files

In all WSO2 products, you also have the option of creating datasources be simply creating a configuration file with the datasource information and storing it in the <PRODUCT_HOME>/repository/conf/datasources/ directory. For example, all WSO2 products are shipped with the default WSO2_CARBON_DB database, and the datasource that is used to connect to this database is defined in the master-datasources.xml file stored in the datasources folder. You can also create your own custom datasources by creating configuration files and storing them in the same folder. For example, see the custom-datasources.xml file. The datasources defined using configuration files can be viewed using the management console if the datasource management feature is installed. 

Note

When adding an RDBMS datasource, be sure to copy the JDBC driver JAR file for your database to <PRODUCT_HOME>/repository/components/lib.

Editing

...

datasource information

After datasources are created (either using the management console or by creating a separate configuration file), you can access them by clicking clicking Data Sources on the  on the Configure tab  tab of the management console as shown below. 
Image Added 

 You can also edit and delete the datasoures datasources that are saved in the registry (i.e. datasources created using the management console). However, you cannot edit or delete the datasources that are added using configuration files in the the <PRODUCT_HOME>/repository/conf/datasources/ directory  directory using the management console. For example, to modify the default <WSO2_CARBON_DB> DB> datasource, you have to change the the master-datasources.xml file file.