...
A datasource is used to establish the connection to a database. By default, WSO2_CARBON_DB
datasource is used to connect to the default H2 database, which stores registry and user management data. After setting up the Remote H2 database to replace the default H2 database, either change the default configurations of the WSO2_CARBON_DB
datasource, or configure a new datasource to point it to the new database as explained below.
...
- Add a new datasource with similar configurations as the
WSO2_CARBON_DB
datasource above to the <PRODUCT_HOME>/repository/conf/datasources/
master-datasources.xml
file. Change its elements with your custom values. For instructions, see Setting up datasource configurations. If you are setting up a separate database to store registry-related data, update the following configurations in the <
PRODUCT_HOME>/repository/conf/
registry.xml
file.Code Block language xml <dbConfig name="wso2registry"> <dataSource>jdbc/MY_DATASOURCE_NAME</dataSource> </dbConfig>
If you are setting up a separate database to store user management data, update the following configurations in the <
PRODUCT_HOME>/repository/conf/
user-mgt.xml
file.Code Block language xml <Configuration> <Property name="dataSource">jdbc/MY_DATASOURCE_NAME</Property> </Configuration>
...
- Run the
./h2.sh
command to start the Web console. - Copy the script text from the SQL file.
- Paste it into the console.
- Click Run.
Restart the server.
Info You can create database tables automatically when starting the product for the first time by using the
-Dsetup
parameter as follows:For Windows:
<PRODUCT_HOME>/bin/wso2server.bat -Dsetup
For Linux:
<PRODUCT_HOME>/bin/wso2server.sh -Dsetup
Multiexcerpt include | ||||
---|---|---|---|---|
|
...
hidden | true |
---|
Note to writers: Add this content at the end of the page if any of the additional databases is relevant to your product.
Changing the identity/storage/product-specific databases
The topics above show how to change the WSO2_CARBON_DB
, which is used to store registry and user manager information. If you changed the product-specific database thatcome by default or set up a separate database for identity or storage related data, the instructions are the same. In summary:
...
Add a newdatasourceconfiguration to the following files for each of the separate databases that you need to create.
For the identity database | Add it to the < |
For the storage database | Add it to the <PRODUCT_HOME>/repository/conf/datasources/<check the correct path and add file name (something like master-datasources.xml) |
For the product-specific database | Add it to the <PRODUCT_HOME>/repository/conf/<check the correct path and add file name (something like api-manager.xml) |
Create the database tables using the following scripts:
...
Update the following configurations, with the defined datasourcename of the corresponding database configuration you added to the <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml
file.
If you are setting up a separate database to store identity relateddata, update the following configurations in the <PRODUCT_HOME>/repository/conf/identity.xml
file.
Code Block | ||
---|---|---|
| ||
<JDBCPersistenceManager>
<DataSource>
<!-- Include a data source name (jndiConfigName) from the set of datasources defined in master-datasources.xml -->
<Name>jdbc/WSO2CarbonDB</Name>
</DataSource>
</JDBCPersistenceManager> |
...