Table of Contents
Introduction
Before using In order to use the RDBMS provisioning facility offered by WSO2 Storage Server, as the first step, you need to configure RDBMS servers using a configuration file. This includes setting up RSS metadate repository that is used to maintain user-created databases, database users and privilege templates. By default, the RSS metadata repository is pointed to an embedded H2 database that is shipped as part of the WSO2 Storage Server installation archive.
...
Create a DataSource in the
<PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml
file and point to that from the<PRODUCT_HOME>/repository/conf/etc/rss-config.xml
file using its JNDI name.
Do the following configuration changes in the<PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml
file. (In this example, our metadata repository database name is “rss_db
”. )Localtabgroup Localtab active true title SQL SERVER SQL SERVER configurations:
Code Block language html/xml <datasource> <name>MetadataRepo</name> <jndiConfig> <name>MetadataRepoDS</name> </jndiConfig> <definition type="RDBMS"> <configuration> <dataSourceClassName>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</dataSourceClassName> <dataSourceProps> <property name="serverName">192.168.17.21</property> <property name="portNumber">1433</property> <property name="databaseName">rss_db</property> <property name="user">RootUser</property> <property name="password">RootPassword</property> </dataSourceProps> </configuration> </definition> </datasource>
In this example, it uses Microsoft JDBC driver to connect to the database. You have to configure SQL Server to use XA datasource before configuring Storage Server. Configuration instructions can be found at http://msdn.microsoft.com/en-us/library/aa342335.aspx.
Info You can also use jTDS JDBC driver instead of Microsoft driver. Then
dataSourceClassName
in the above configuration should benet.sourceforge.jtds.jdbcx.JtdsDataSource
. The server configuration instructions for XA datasources can be found in the README.XA file in the jTDS driver distribution pack.Localtab title MySQL MySQL configurations:
Code Block language html/xml <datasource> <name>MetadataRepo</name> <jndiConfig> <name>MetadataRepoDS</name> </jndiConfig> <definition type="RDBMS"> <configuration> <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName> <dataSourceProps> <property name="URL">jdbc:mysql://localhost:3306/rss_db</property> <property name="user">RootUser</property> <property name="password">RootPassword</property> </dataSourceProps> </configuration> </definition> </datasource>
Localtab title PostgreSQL PostgreSQL configurations:
Code Block language html/xml <datasource> <name>MetadataRepo</name> <jndiConfig> <name>MetadataRepoDS</name> </jndiConfig> <definition type="RDBMS"> <configuration> <dataSourceClassName>org.postgresql.xa.PGXADataSource</dataSourceClassName> <dataSourceProps> <property name="serverName">localhost</property> <property name="portNumber">5432</property> <property name="databaseName">rss_db</property> <property name="user">RootUser</property> <property name="password">RootPassword</property> </dataSourceProps> </configuration> </definition> </datasource>
Info When creating above database user, make sure to grant all privileges for the database before creating any tables in it. (i.e. before you run the database script on database.)
The elements of the sample configuration are explained below. You can use this information to edit the file according to your requirements. For more information please see configuring master datasources.
Property Name Description Type Default Value Fixed Values Mandatory/Optional <dataSourceClassName>
This is the XA Driver Class provided by the JDBC driver used to connect to the type of RDBMS in which the RSS metadata repository is configured.
E.g., if RSS metadata repository database is configured on MySQL - "
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
" has to be used as the value of this particular attribute.Mandatory <dataSourceProps>
Root element of the XA data source property collection that needs to be configured in order to initialize the XA datasource driver used in the RSS metadata repository configuration.
-
-
Mandatory
<property name="property_name">+
Element used to specify bean properties of the XA datasource driver used in RSS metadata repository configuration. (Note: The set of properties that are to be configured are different based on the XA driver class used).
E.g., the sample configuration which can be used to populate the bean properties required for MySQL XA driver is as follows:
Code Block language html/xml <dataSourceProps> <property name = "URL">xxxx</property> <property name = "user">xxxx</property> <property name = "password">xxxx</property> </dataSourceProps>
-
-
Mandatory
The
rss-config.xml
file is located in<PRODUCT_HOME>/repository/conf/etc/rss-config.xml
file.Code Block language html/xml <ManagementRepository> <DataSourceConfiguration> <JndiLookupDefinition> <Name>MetadataRepoDS</Name> </JndiLookupDefinition> </DataSourceConfiguration> </ManagementRepository>
Please note that JNDI name of both config files should be the same. In this example, it is "MetadataRepoDS".
Change following properties in
<PRODUCT_HOME>/repository/conf/etc/persistence.xml
.Localtabgroup Localtab active true title SQL SERVER SQL SERVER configurations:
Code Block language html/xml <property name="openjpa.ConnectionDriverName" value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" /> <property name="dialect" value="org.apache.openjpa.jdbc.sql.SQLServerDictionary" />
Localtab title MySQL MySQL configurations:
Code Block language html/xml <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" /> <property name="dialect" value="org.apache.openjpa.jdbc.sql.MySQLDictionary" />
Localtab title PostgreSQL PostgreSQL configurations:
Code Block language html/xml <property name="openjpa.ConnectionDriverName" value="org.postgresql.xa.PGXADataSource" /> <property name="dialect" value="org.apache.openjpa.jdbc.sql.PostgresDictionary" />
Configure the RSS Environment by using the following configuration in the rss-config.xml file.
Localtabgroup Localtab active true title SQL SERVER SQL SERVER configuration:
Code Block language html/xml <Provider>SQLSERVER</Provider> <Environments> <Environment> <Name>DEFAULT</Name> <RSSInstances> <RSSInstance> <Name>WSO2RSS1</Name> <InstanceType>SYSTEM</InstanceType> <DbmsType>SQLSERVER</DbmsType> <ServerCategory>LOCAL</ServerCategory> <DataSourceConfiguration> <Definition> <Url>jdbc:sqlserver://192.168.17.21</Url> <Username>RootUser</Username> <Password>RootPassword</Password> <DriverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</DriverClassName> </Definition> </DataSourceConfiguration> </RSSInstance> </RSSInstances> </Environment> </Environments>
If you use jTDS JDBC driver, the
DriverClassName
should benet.sourceforge.jtds.jdbc.Driver
.Localtab title MySQL MySQL configuration:
Code Block language html/xml <Provider>MYSQL</Provider> <Environments> <Environment> <Name>DEFAULT</Name> <RSSInstances> <RSSInstance> <Name>WSO2RSS1</Name> <InstanceType>SYSTEM</InstanceType> <DbmsType>MYSQL</DbmsType> <ServerCategory>LOCAL</ServerCategory> <DataSourceConfiguration> <Definition> <Url>jdbc:mysql://localhost:3306</Url> <Username>RootUser</Username> <Password>RootPassword</Password> <DriverClassName>com.mysql.jdbc.Driver</DriverClassName> </Definition> </DataSourceConfiguration> </RSSInstance> </RSSInstances> </Environment> </Environments>
Localtab title PostgreSQL PostgreSQL configuration:
Code Block language html/xml <Provider>POSTGRES</Provider> <Environments> <Environment> <Name>DEFAULT</Name> <RSSInstances> <RSSInstance> <Name>WSO2RSS1</Name> <InstanceType>SYSTEM</InstanceType> <DbmsType>POSTGRES</DbmsType> <ServerCategory>LOCAL</ServerCategory> <DataSourceConfiguration> <Definition> <Url>jdbc:postgresql://localhost:5432</Url> <Username>postgres</Username> <Password>postgres</Password> <DriverClassName>org.postgresql.Driver</DriverClassName> </Definition> </DataSourceConfiguration> </RSSInstance> </RSSInstances> </Environment> </Environments>
...