RDBMS datasource type allows you to create a data service using a relational database as the datasource.
First, follow the steps in Creating Datasources. When you select RDBMS as the type at the time a datasource is created, the RDBMS-specific options appear. For example:
The options in the above window are described below:
datasource type
There are two types of RDBMS datasources as follows:
- Default
For the default type, connection properties such as driver class, URL and credentials must be entered as shown in the example above. - External datasource
If you need to add a datasource supported by an external provider class such ascom.mysql.jdbc.jdbc2.optional.MysqlXADataSource
, select the external option and enter the name and value of connection properties by clicking Add Property. For example,
After an external datasource is created, it can be used as a usual datasource in queries.
Database engine
The database management system. In the above example, we take MySQL.
Driver class/URL
Depending on the database engine, copy the relevant JDBC driver to:
- <PRODUCT_HOME>/repository/components/lib directory
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. For example, 'Cannot load JDBC driver class com.mysql.jdbc.Driver'.
Use as secret alias
For information, see Securing Passwords.
datasource configuration parameters
For information, see Datasource Configuration Parameters.
Dynamic user authentication
For information, see Dynamic User Authentication.
To write a query to this datasource, see Writing Data Service Queries.