Liferay.com

Tuesday, November 29, 2011

How to open HSQL DB tables of Liferay in eclipse


Earlier i blogged about how to connect to HSQL DB from command prompt using HSQL Database Manager. Now as per request i have blogged to connect to HSQL DB form Eclipse

> Open Data source explorer in Eclipse

> Right click on Database Connections > New, you see screen looking like below as shown in Figure.1

> Type hsql as showing screen below & select HSQLDB - Give a name to your DB connection

Figure.1



> Do as described in Figure.2 below(Point to a Liferay DB which is using HSQL)

Figure.2
> You will see screen like below in Figure.3, once done close this window

Figure.3
NOTE : Here jar file you will using should point to the hsql.jar you have for Liferay installation under tomcat/lib/ext (Below is the screen shot for the same)





> Now you have to give proper Liferay DB name & Database location - Give DB connection other will be populated automatically. Check the save password check box. In my case DB location is

D:\projects\liferay\lr52sp3\liferay-portal-5.2-ee-sp3\data\hsql\lportal

You change this path according to your Liferay instance DB running on HSQL


> You can test the connection as show below


 > Click on Next from above screen, you see below screen check for connection profile & click finish


> You will be redirect to Datasource Explorer, which looks like below




Please feel free to add comments.

Cheers :)

12 comments:

  1. Great blog!
    Thanks Nagendra, that was very helpful.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi Nagendra,

    Thanks for the article.It's working nice for 6.0.5 but i am unable to do the same for LR 6.1.
    Any pointer?

    ReplyDelete
  4. Can you please share error what you are getting for LR 6.1, basically this configuration nothing to do with version Liferay - from the eclipse point of view just connecting to any DB

    ReplyDelete
  5. Hi I also get the same problem for Liferay 6.1 :
    - the database name is not filled
    - if I try with lportal (file names are lportal) no tables are present

    ReplyDelete
  6. Ok I fixed (on luck).

    Instead of filling the location as ${liferay.home}/data/hsql (in Liferay6.1 there is not lportal directory in it), I used ${liferay.home}/data/hsql/lportal
    (and lportal as db name)

    Now this works fine.

    ReplyDelete
  7. Thank you very much for sharing info

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. i want to add new table in sample database which is present in hsqldb.can you explain me the steps required for this process??

    ReplyDelete
  10. I hope it should be fairly as simple as adding a table in traditional RDBMS using create table syntax listed below

    http://www.w3schools.com/sql/sql_create_table.asp

    let me know if you are not able to do it

    ReplyDelete
  11. Using service builder i have created a table but i was not able to find it in lportal db where can i find it

    ReplyDelete
    Replies
    1. Are you trying to use HSQL even for your custom portlet development?

      Are you able to see other liferay default tables?

      By default service builder related tables will be generated with the namespace your provided in namespace element of service.xml under service-builder along with entity name

      Delete