Below are the steps for configuring WSO2 Governance Registry with H2 remote database.
Download and install H2 DB in you computer, if it is not already done. You can find H2 installation guide from here.
Goto the $H2_HOME/bin directory and run the h2 network server starting script. $H2_HOME is the installation directory of H2
Run H2 database server with following commands.
$ ./h2.sh
$ h2.bat
The script will start the database engine and bring up a pop up window with start browse button.
"Start Browser" button will open a web browser containing a client application using which you can connect to a database.
h2 will automatically create a database, if a database does not exist by the name you provide in the 'JDBC URL' text box.
Setup Configuration Files
Edit the $CARBON_HOME/con/registry.xml file, where CARBON_HOME is the installation directory of the registry distribution.
note the highlighted configurations, You
may use your own database name, username and password
Explanation of the database configuration options.
url: The URL of the database
userName: The name of the database user
password: The password of the database user
maxActive: The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxWait: The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before throwing an
exception, or <= 0 to wait indefinitely.
minIdle: The minimum number of active connections that can remain idle in the
pool, without extra ones being created, or 0 to create none.
Edit the $CARBON_HOME/conf/user-mgt.xml file as below
(Note that you have to replace these settings with your custom values).
Copy H2 database driver (org.h2.Driver) to $CARBON_HOME/repository/components/lib. One could find the required driver jar in $H2_HOME/bin/h2-*.jar
Create Database
Automatic Database Creation
Next at the first time you start the registry, run with the -Dsetup option, so
it will create the H2 database with all the underlying tables.
sh wso2server.sh -Dsetup
wso2server.bat -Dsetup
Manual Table Creation using scripts
Tables can be manually created by logging into created database and running and following script in H2 shell or web console.
CARBON_HOME/dbscripts/h2.sql
After setting up the registry DB tables. start the server with below commands.
sh wso2server.sh
wso2server.bat
Setting up with embedded H2 Database
Preparing the Embedded H2 Database
Below are the steps for configuring WSO2 Governance Registry with H2 embedded database.
Download and install H2 DB in you computer, if it is not already done. You can find H2 installation guide from here.
Setup configuration Files
Edit the $CARBON_HOME/con/registry.xml file, where CARBON_HOME is the installation directory of the registry distribution.
note the highlighted configurations, You
may use your own database name, username and password.
Explanation of the database configuration options.
url: The URL of the database
userName: The name of the database user
password: The password of the database user
maxActive: The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxWait: The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before throwing an
exception, or <= 0 to wait indefinitely.
minIdle: The minimum number of active connections that can remain idle in the
pool, without extra ones being created, or 0 to create none.
Edit the $CARBON_HOME/conf/user-mgt.xml file as below
(Note that you have to replace these settings with your custom values).
Copy H2 database driver (org.h2.Driver) to $CARBON_HOME/repository/components/lib. One could find the required driver jar in $H2_HOME/bin/h2-*.jar
Create Database
Automatic Database Creation
Next at the first time you start the registry, run with the -Dsetup option, so
it will create the H2 database with all the underlying tables.
sh wso2server.sh -Dsetup
wso2server.bat -Dsetup
Manual Table Creation using scripts
Tables can be manually created by logging into created database and running and following script in H2 shell or web console.
CARBON_HOME/dbscripts/h2.sql
After setting up the registry DB tables. start the server with below commands.
sh wso2server.sh
wso2server.bat