Every WSO2 product comes with an embedded H2 database as the default database configuration. There can be times we need to see the content of this database.
In this post, I'm going to explain how to see this database content through the H2 console.
First you have to configure the following in the <product-home>/repository/conf/carbon.xml file.
Then open a browser and goto "http://localhost:8082/". You can see the login page as follows.
You need to give the JDBC URL, username and password.
You can find the relevant JDBC URL in the <product-home>/repository/conf/datasources/master-datasources.xml
For example, in ML, it is given as follows;
element. Here it is jdbc:h2:repository/database/WSO2ML_DB.
Give the username and password given in the and elements in the above configuration. (The default username and password comes with every wso2 product is admin, admin)
You will see the H2 console like this.
Note :
When you need to do some change in the database of a wso2 product and setup the server with that change, you have to run the startup script as follows.
./wso2server.sh -Dsetup
Note that, in order to apply the changes first you have to delete the contents in the directory <product-home>/repository/database. Then start the server with -Dsetup option.
In this post, I'm going to explain how to see this database content through the H2 console.
First you have to configure the following in the <product-home>/repository/conf/carbon.xml file.
Once the configuration done as above, start the server(wso2 product you want).8082
Then open a browser and goto "http://localhost:8082/". You can see the login page as follows.
You need to give the JDBC URL, username and password.
You can find the relevant JDBC URL in the <product-home>/repository/conf/datasources/master-datasources.xml
For example, in ML, it is given as follows;
Copy the url given in theWSO2ML_DB The datasource used for Machine Learner database jdbc/WSO2ML_DB jdbc:h2:repository/database/WSO2ML_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000 wso2carbon wso2carbon org.h2.Driver 50 60000 true SELECT 1 30000
Give the username and password given in the
You will see the H2 console like this.
Note :
When you need to do some change in the database of a wso2 product and setup the server with that change, you have to run the startup script as follows.
./wso2server.sh -Dsetup
Note that, in order to apply the changes first you have to delete the contents in the directory <product-home>/repository/database. Then start the server with -Dsetup option.