Monday, October 19, 2015

Accessing local H2 database of WSO2 products

All WSO2 products internally use the H2 database by default. H2 is a light weight file based database system. By using H2 WSO2 products can readily be used for experimentation without configuring an industry ready RDBMS. Though, H2 is not recommended for any production systems, it's often the case that many try out WSO2 products with H2 initially thereby frequently needing to view the contents of the tables. 

This short tutorial gives you a guide to view WSO2 database tables in H2.

The process is simple. Add the following configuration to the repository/conf/carbon.xml and restart the server.
    <H2DatabaseConfiguration>
        <property name="web" />
        <property name="webPort">8082</property>
        <property name="webAllowOthers" />
    </H2DatabaseConfiguration>
Once the server is restarted, navigate to http://localhost:8082/. You'll be redirected to a view like following.



In JDBC URL fill out where the WSO2CARBON_DB is. It's located in repository/database directory. Assuming the CARBON_HOME is you product home directory, JDBC URL would be, jdbc:h2:CARBON_HOME/repository/database/WSO2CARBON_DB (make sure to replace the CARBON_HOME with your actual path) Click connect to see the tables and you are good to try out executing some SQL.

1 comment:

  1. Find complete solution at https://medium.com/@smartsplash/accessing-the-h2-database-for-wso2-products-c5d44b2f5590

    ReplyDelete