Thursday, February 26, 2015

Browse built-in H2 database of WSO2 Products

WSO2 products in default are shipped with H2 database which is good for development, testing, experimental work and for some production systems. WSO2 products also support industry-standard RDBMS such as Oracle, PostgreSQL, MySQL, MS SQL.

When you develop, test and experiment with default H2 database, sometimes you want to go inside the database and see.

And this is how to do it.

1. Go to the <PRODUCT_HOME>/repository/conf/

2. Open the carbon.xml file to edit.

3. Enable the H2DatabaseConfiguration as follows and Save changes.


<H2DatabaseConfiguration>
        <property name="web"/>
        <property name="webPort">8082</property>
        <property name="webAllowOthers"/>        
</H2DatabaseConfiguration>

4. Go to <PRODUCT_HOME>/bin and start the the server as follows.
    e.g.: > sh wso2server.sh

5. Open URL http://localhost:8082/ from browser.



6. Complete the following fields with appropriate values.
Driver Class: org.h2.Driver
JDBC URL  : jdbc:h2:<PRODUCT_HOME>/repository/database/WSO2CARBON_DB
Username    : wso2carbon
Password     : wso2carbon

7. Once you connect to the database you will see a similar UI as follows.

In this example I have used WSO2 API Manager 1.7.0 and connected to the WSO2AM_DB database at <product_home>/repository/database/WSO2AM_DB