Versions Compared

Key

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

...

  1. In the management console, click the Configure tab, and then click Data Sources.  
  2. Click Add Data Source.  
  3. Specify the required options for connecting to the database. The required fields vary depending available options are based on the type of datasource type you selectare creating:
RDBMS

Configuring an RDBMS datasource
Anchor
rdbms
rdbms

When you select RDBMS as the datasource type, the following screen appears:

This is the default RDBMS datasource configuration provided by WSO2. You can also write your own RDBMS configuration by selecting the custom datasource option. Enter values for the following fields when using the default RDBMS datasource configuration:

  • Data Source Type: RDBMS
  • Name: Name of the datasource (must be a unique value)
  • Data Source Provider: Specify the datasource provider as described below
  • Driver: The JDBC driver to use
  • URL: The connection URL to pass to the JDBC driver to establish the connection
  • User Name: The connection user name to pass to the JDBC driver to establish the connection
  • Password: The connection password to pass to the JDBC driver to establish the connection
  • Expose as a JNDI Data Souce: Allows you to specify the JNDI data source as described below
  • Data Source Configuration Parameters: Allows you to specify advanced configuration properties when creating an RDBMS datasource

Many of these fields are similar to those in DBCP. For more information, see: http://commons.apache.org/dbcp/configuration.html

After creating datasources, you can edit and delete them as needed.

...

If you need to add a datasource supported by an external provider class such as com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, select External Data Source, click Add Property, and then enter the name and value of each connection property you need to configure. Following is an example datasource for an external datasource provider.

JNDI

...

datasource
Anchor
jndi
jndi

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

...

  • Name: Name of the JNDI datasource that will be visible to others in object look-up
  • Use Data Source Factory: To make the datasource accessible from an external environment, you must use a data source factory. When this option is selected, a reference object will be created with the defined datasource properties. The data source factory will create the datasource instance based on the values of the reference object when accessing the datasource from an external environment. In the datasource configuration, this is set as follows:
    <jndiConfig useDataSourceFactory="true">
  • JNDI Properties: Properties related to the JNDI datasource (such as password). When you select this option, set the following properties:
    • java.naming.factory.initial - Selects the registry service provider as the initial context
    • java.naming.provider.url - Specifies the location of the registry when the registry is being used as the initial context

...

Configuring a custom datasource 
Anchor
custom
custom

If you select the Custom datasource type, the following screen will appear:

Specify the following Following is a description of the custom datasource fields:

  • Data Source Type: Custom
  • Custom Data Source Type: Specify whether the data is in a table or accessed through a query as described below
  • Name: Enter a unique name for this datasource
  • Description: Description of the datasource
  • Configuration: XML configuration of the datasource

...