Tuesday 22 July 2014

Liferay HSQL DB Access

        Normally at the time of development, we have fixed name of database which will be used for production environment. We configure the same DB in our local or development environment for the build. But in case of doing POC, preparing demo for PreSales or making some reusable component, we might not have access to such environment, or as per the system requirement, It might not be a good idea to spend time after configuring other DB.

        Liferay is using HSQL database by default. Here is the steps to access that HSQL database using DatabaseManager.


  1. Go to {server}\lib\ext , Make you have hsql.jar file under that location. If it's not there. Find the location of that jar.
  2. Open command prompt with the location of step-1
  3. Run this command in command prompt "java -cp hsql.jar org.hsqldb.util.DatabaseManager"
  4. Database manager will open as per the below image.
  5. Select "HSQL Database Engine Standalone" for dropbox of type.
  6. Now in URL text field you need to enter location of the DB file. So if you check in your Liferay bundle. There would be lportal HSql DB in "{liferay-portal}\data\hsql" directory. So you need to give path to DB as like "{liferay-portal}\data\hsql\lportal", here lportal is the DB.
  7. Username will be 'SA' and password will be blank. 
        Once the DB is connected. You will be able to see the list of the tables on the left hand side. As well you can execute any query using the same browser.


       One important point, If the Liferay instance is running. There would be lock on DB. So you won't be able to access the DB. 

0 comments:

Post a Comment