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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

A datasource is a connection set up to a storage of data, such as a database or a data file, from a server. If you have installed the Data Sources feature in your instance of Identity Server, you can create an RDBMS datasource using the management console as follows.

  1. Log in to the product's management console and select Datasources sub menu from the Configure menu.
  2. Click Add Datasource.  
  3. The New Datasource page opens. Select RDBMS as the datasource type, provide a unique name and configure the rest of the fields using the information below:

    • Datasource Provider : See below
    • Driver : Copy the JDBC driver relevant to the database engine to:
      • <PRODUCT_HOME>/repository/components/lib
      • <PRODUCT_HOME>/repository/components/dropins

        For example, cp mysql-connector-java-5.XX-bin.jar/home/user/wso2ds/wso2-dataservices-XX/repository/components/lib

        NOTE: If the driver class does not exist in the relevant folders when you create the datasource, you get an exception similar to the example 'Cannot load JDBC driver class com.mysql.jdbc.Driver'.

    • URL : The connection URL to be passed to the JDBC driver to establish a connection
    • User Name/Password : The connection user name and password to be passed to the JDBC driver to establish a connection   
    • Expose as a JNDI datasource : See below
    • datasource Configuration Parameters : Additional properties that you can define when creating an RDBMS datasource. For more information on these properties, see Properties of RDBMS datasources .

    Also see the DBCP configuration guide at http://commons.apache.org/dbcp/configuration.html for more information on each of the above fields.

Datasource provider

A datasource provider connects to a source of data such as a database, accesses its data and returns the results of the access queries.

There are two types of datasource providers - the default or the external. To configure the default datasource provider, give the connection properties as Driver, URL, User Name and Password as shown in the following example:

To add a 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 as shown in the following example:

JNDI datasource

Java Naming and Directory Interface (JNDI) is a Java application programming interface (API) providing 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 register a datasource with JNDI, others can discover it through a JNDI look-up and use it.

To expose a datasource as a JNDI datasource, expand Expose as a JNDI Datasource option in the New Datasource page and fill in the following fields:

  • Name : Name of the JNDI datasource that is visible to others in object look-up
  • Use Datasource Factory : Used when the datasource needs to be accessed from an external environment. When this field is selected, a reference object is created with defined datasource properties. The datasource factory creates the datasource instance, based on the values of reference objects, when accessing the datasource from an external environment. In the configuration, this is set as useDataSourceFactory="true".
  • JNDI Properties: Properties related to the jndi datasource (password etc). If you select the Use datasource Factory option, specify the following properties:
    • 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
  • No labels