HSQLDB is a portable RDBMS implemented in pure java. It can be embedded with your application as well as can be used separately. It is very a small database that supports almost all features of the standard database system. It comes with small jar file that can be found in lib folder.
The HSQLDB jar package is located in the /lib directory of the ZIP package and contains several components and programs. Core components of jar file are : HyperSQL RDBMS Engine (HSQLDB), HyperSQL JDBC Driver, Database Manager, and Sql Tool.
Installing and Using
And you will see console output as below
Installing and Using
Download: download latest release of HyperSQL database from http://hsqldb.org website and extract it. You will see following contents.
Here "bin" directory contains some batch files those can be used to run a swing based GUI tool. You can use runManagerSwing.bat to connect to database, but database must be on before running it.
Directory lib contains File hsqldb.jar . It is the database to be used by you.
Running database
First of all, java must be in the path of your command prompt before doing anything. If it is not in command prompt, execute following command into command prompt
hsqldb>set path=%path%;D://program files/java/jdk1.6.0_13/bin
Now check whether java in the path or not. Just execute javac command and wait. If path has been set to java, then it will display some textual output showing command options.
Now prepare a file named server.properties and place it in hsqldb directory with following contents.
Now execute following command on command prompt
hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server
As above command executes you will see some output and a new directory will be created into current path with named hsqldb in which you will find following contents
Once you created database then you have to run the command same way as before with some extra arguments to connect with existing database e.g.
hsqldb>java -classpath lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:hsqldb/hemrajdb --dbname.0 testdb
This command will start database server and then you need to run runManagerSwing.bat file from bin directory. Before start you have to enter some connection configurations and then press ok button to connect to the graphical user interface to database.
After connecting to your database, you can create tables using SQL statement and insert data into table. To view data from the table just execute select SQL statement for that table. You will get something like below.
See also :
Comments
Though I was able to understand the steps but still it would be better if it is refined a little bit.
Thanks a Lot for this Post.
I would like to know how to connect a hsqldb emebbed into a web .war app in file mode.
Can you help please ?
Thanks
Thanks
Thanks
Is there something in the samples directory that loads this schema?
Did you accidentally delete this step in the entry during some edit?
You start the database twice and magically there is a defined testdb schema.
Magic. Please explain.
Thanks for making this available. It was a great help.
Thanks!
Thank you for simple and nicely explained article. It certainly helped a lot.
-ShekharL