HSQLInspect

标签: hsql hsqldb

This page describes a simple way to inspect the in-memory HSQL database that is used in the default Liferay bundles. You should stop the application server that's accessing the database before inspecting / modifying it with the procedure below.

Obtain HSQL JDBC Driver #

The HSQLDB JDBC driver is bundled in the main HSQL JAR. Download the HSQL distribution. In the lib directory you should find hsql.jar. Make a note of the location.

Obtain SquirrelSQL #

SquirrelSQL is an open-source database explorer that supports any JDBC accessible database.

Configure the HSQL Driver #

In the "drivers" pane in SquirrelSQL, you should see "HSQLDB In-Memory". It will have a red X in front of it meaning that you have not yet configured the JDBC driver location. Edit this driver (the pen icon). In the opened window, click the "extra class path" tab. Click "add" and navigate to hsqldb.jar from the HSQL distribution. The "class name" field below should now be filled in with "org.hsqldb.jdbcDriver".

Create an Alias #

An alias is a pre-configured connection to a particular database. In the alias pane, click new (the + icon). The URL should be of the form jdbc:hsqldb:file:<path>/lportal, where <path> is the current working directory of the application server, which is usually the directory where you executed the application server's start command. Look for lportal.script, lportal.log, etc. to validate that you have the correct path.

For example: jdbc:hsqldb:file:/Users/jtb/glassfish/lportal

The user name should be "sa", and the password "" (blank).

Connect #

Make the connection by double-clicking on the alias. Liferay's tables are under PUBLIC/TABLES.

0 附件
47369 查看
平均 (3 票)
满分为 5,平均得分为 4.33333333333333。
评论
讨论主题回复 作者 日期
Perfect article! :D Brian Preuß 2008年9月9日 上午4:10
Awesome! Thank you Andreas Minnich 2008年11月12日 上午6:30
adsf Ramdas Sawant 2008年12月8日 下午10:30
Dot even need SquirrelSQL. Use hsqldb builtin... Ramdas Sawant 2008年12月8日 下午10:32
Can you please detail "Create an Alias" part...... ilke Muhtaroglu 2010年7月1日 上午5:38
The information helped a lot. Ricardo Kehrle Miranda 2010年7月5日 下午12:40
It failed in the connection to the data base.... Tom I. 2010年11月16日 上午3:28
Try this: 1. Shutdown your liferay server; 2.... Henrique Fernandes 2010年12月13日 上午6:47
Hi, I tried to configure the liferay HSQLDB as... Fatema Rajkotwala 2012年2月16日 下午7:13
Make sure that the server is stopped while... Huage Chen 2013年6月18日 上午7:35
Hi, I get an error when trying to connect:... David Lee 2014年2月5日 下午3:18
If you are having trouble seeing the Liferay... David Benson 2014年6月10日 上午1:56
Thanks, this worked for me. Christian Wilkie 2014年7月10日 下午12:22

在 08-9-9 上午4:10 发帖。
在 08-11-12 上午6:30 发帖。
在 08-12-8 下午10:30 发帖。
Dot even need SquirrelSQL. Use hsqldb builtin db explorer

java -cp <path of hsqldb.jar> org.hsqldb.util.DatabaseManager

Go ahead with "Create an Alias" step described above

Cheers !!!!!
在 08-12-8 下午10:32 发帖以回复 Ramdas Sawant
Can you please detail "Create an Alias" part...

in Configure the HSQL Driver, it is told that we should provide the hsql.jar (this already exists in /lib/ext of liferay tomcat distribution, ok?)

then we are told to provide an url, which is in form "jdbc:hsqldb:."

there it is told url should be "jdbc:hsqldb:file:<path>/lportal"

( according to this link: http://www.emforge.net/web/liferay-petstore-portlet/wiki/-/wiki/Main/Step1:+From­+DB+to+simple+UI )

( according to this link: http://www.liferay.com/community/forums/-/message_boards/message/70471 )

so what I try is to give URL:

jdbc:hsqldb:file:/home/ilke/lportal6/liferay-apache-tomcat-6.0.26/bin/lporta­l


Then I get the following error by SQuirreL:

( liferay_hsql: The database is already in use by another process: lockFile: org.hsqldb.persist.LockFile@b82b963b[file =/home/ilke/lportal6/liferay-apache-tomcat-6.0.26/bin/lportal.lck, exists=true, locked=false, valid=false, ] method: checkHeartbeat read: 2010-07-01 15:35:24.417 heartbeat - read: -9854 ms.
)


I use Ubuntu, liferay deployed into tomcat.

ilke
在 10-7-1 上午5:38 发帖。
The information helped a lot.
在 10-7-5 下午12:40 发帖。
It failed in the connection to the data base.
The database is already in use by another process: lockFile: org.hsqldb.persist.LockFile@aadfcab9

Is there a way to inspect HSQL data during debug in Eclipse?
在 10-11-16 上午3:28 发帖。
Try this:

1. Shutdown your liferay server;
2. Edit [LIFERAY_HOME]\data\hsql\lportal.properties
3. Set hsqldb.lock_file=false
在 10-12-13 上午6:47 发帖以回复 Tamas Imrei
Hi,
I tried to configure the liferay HSQLDB as mentioned in the above article.
I gave the URL as jdbc:hsqldb:fileemoticon:/<Liferay_HOME>/data/hsql/Iportal
I am not getting any errors and when I am testing the Squirrel connection it is showing as Connection successful.
But still I am not able to view the liferay tables.Is there something more that needs to be configured.Please help me out.
在 12-2-16 下午7:13 发帖。
Make sure that the server is stopped while access the HSQLDB
在 13-6-18 上午7:35 发帖以回复 Fatema Rajkotwala
Hi,
I get an error when trying to connect:
Caused by: java.sql.SQLException: Unable to create connection. Check your URL.
at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverMana­ger.java:136)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.execu­teConnect(OpenConnectionCommand.java:167)
... 8 more

I am running Windows. So my URL is:
jdbc:hsqldb:file:c:/liferay/data/hsql/lportal

Is this correct? Please help. Thanks in advance!!
在 14-2-5 下午3:18 发帖。
If you are having trouble seeing the Liferay tables, try changing the alias path to jdbc:hsqldb:file:/<liferay location>/data/hsql/lportal

This worked for me. Thanks to this post for pointing me in the right direction:
http://btnkumar.blogspot.co.uk/2011/11/how-to-open-hsql-db-tables-of-l­iferay_29.html
在 14-6-10 上午1:56 发帖。
Thanks, this worked for me.
在 14-7-10 下午12:22 发帖以回复 David Benson