Configuring Data Persistence With RDBMS
WSO2 DAS supports several RDBMS types for its underlying Data Access Layer (DAL). In order to use the RDBMS DAL component, a pre-configured installation of a RDBMS is required. The RDBMS implementation for the DAS DAL contains the implementations of Analytics Record Store. The following sections describe both implementations of the Cassandra DAL component
The RDBMS datasource supports both pagination and record count. Pagination support and record count support are disabled by default. You can enable them by setting the value of paginationSupported
and recordCountSupported
properties in the <DAS_HOME>/repositor/conf/analytics/rdbms-config.xml
file to true
.
Enabling the RDBMS datasource provider
In order to use RDBMS as the record store, ensure that the RDBMS datasource provider is enabled by following the steps below.
RDBMS is the default database type of the record store. Therefore, the RDBMS datasource provider is uncommented by default.
- Open the
<DAS_HOME>/repository/conf/datasources/analytics-datasources.xml
file. If the datasource provider is commented out, uncomment it as shown below.
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
Configurations for the Analytics Record Store
The Analytics Record Store consists of two datasource configurations as follows.
Configuring the Event Store
For configuring RDBMS as the underlying datasource implementation for the Event Store of the Analytics Record Store, specify the RDBMS configurations in the <DAS_HOME>repository/conf/analytics/analytics-config.xml
file as shown in the example below.
<analytics-record-store name="EVENT_STORE"> <implementation>org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore</implementation> <properties> <!-- the data source name mentioned in data sources configuration --> <property name="datasource">WSO2_ANALYTICS_EVENT_STORE_DB</property> </properties> </analytics-record-store>
The properties of the above configuration are described below.
Property | Description |
---|---|
<implementation> | The implementation class of the Analytics Record Store relevant for RDBMS, which is org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore . |
<property name="datasource"> | The Carbon datasource name of the RDBMS type, that is used to find the associated RDBMS data source. |
Configuring the Processed Data Store
To configure RDBMS as the underlying datasource implementation for the Processed Data Store of the Analytics Record Store, specify the RDBMS configurations in the <DAS_HOME>repository/conf/analytics/analytics-config.xml
file as shown in the sample below.
<analytics-record-store name = "PROCESSED_DATA_STORE"> <implementation>org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore</implementation> <properties> <property name="datasource">WSO2_ANALYTICS_PROCESSED_DATA_STORE_DB</property> </properties> </analytics-record-store>
The properties of the above configuration are described below.
Property | Description |
---|---|
<implementation> | The implementation class of the Analytics Record Store relevant for RDBMS, which is org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore . |
<property name="datasource"> | The Carbon datasource name of the RDBMS type, that is used to find the associated RDBMS data source. |
RDBMS query configuration
The above Analytics Record Store depends on a query configuration to execute its implementation. The query configuration contains SQL query templates for each of the RDBMS servers that it interfaces with. Using this configuration, you can modify the existing queries for fine tuning, or create new query configurations for a RDBMS that is not configured out of the box. You can find these configurations in the <DAS_HOME>/repository/conf/analytics/rdbms-config.xml
file as shown in the example below. Click on the relevant tab to view the query templates for each database category.
The above configuration properties are described below.
Property | Description |
---|---|
database name | The target RDBMS name to which this query template applies, a regular expression can be put here, to give a pattern on to which a database product name can be mapped. For example, DB2 will give different product name strings when running in Windows and Unix based OS environments, so a regular expression like "DB2.*" will match for all DB2 based database server environments. |
minVersion | The minumum version of the database server this configuration will match to, this will be of format "majorVersion.minorVersion". |
maxVersion | The maximum version of the database server this configuration will match to, this will be of format "majorVersion.minorVersion". |
recordCountSupported | This property specifies whether it is possible to take a count of all the records in the record store. |
paginationSupported | This property specifies whether dividing the output of the record store to manageable chunks is allowed. |
paginationMode | This property specifies the pagination mode. Possible values are as follows. |
blobLengthRequired | This property specifies whether a length should be assigned to data blocks saved in the record store or not. |
recordCountQuery | The query template to take a count of the records in the record store. |
recordDeletionQuery | The query template to delete a record in the record store. |
recordDeletionWithIdsQuery | The query template to delete records with specific IDs in the record store. |
recordMergeQuery | The query template to merge two rows of data of a table in the record store. |
forwardOnlyReadEnabled | If this property is set to true , the cursor can only move forward on the result set when retrieving records from record store. |
fetchSize | Number of rows that should be fetched from the database if more rows are needed on the generated result set when retrieving records from record store. |
recordInsertQuery | The query template to insert new rows of data to a table in the record store. |
recordUpdateQuery | The query template to modify the existing table rows in the record store. |
recordRetrievalQuery | The query template to retrieve a record from the record store. |
recordRetrievalWithIdsQuery | The query template to retrieve records with specific IDs from the record store. |
recordTableCheckQuery | The query template to check tables in the record store. |
recordTableDeleteQueries | The query template to delete a table in the record store. |
recordTableInitQueries | The query template to initialize the tables in the record store. |
Configuring the datasources
Change the configurations of the WSO2_ANALYTICS_EVENT_STORE_DB
datasource in the <DAS_HOME>/repository/conf/datasources/
analytics-datasources.xml
file accordingly. For information on the datasource configurations, see Configuring an RDBMS Datasource.