HSQLDB is more often used for learning purposes since it is so lightweight and easy to set up. I would not recommend using it in an enterprise production environment however. If you wish to use mysql or any other database of your choice, it should be easy to switch the configuration. We’ll get to that later. Now let’s see how to install it fast.
1. Add the HSQLDB database dependency to your pom.xml
Add the following to the list of dependencies to your pom.xml file.
<dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>188.8.131.52</version> </dependency>
2. Start the Database Server.
Go into “Referenced Libraries” inside your SpringGreetings project and right click on hsqldb-184.108.40.206.jar.
Then select Run as … Java Application. Then select “Server – org.hsqldb” and hit Ok.
3. Run the Database Manager.
To access the database, right click again on hsqldb-220.127.116.11.jar and select Run as … Java Application.
Select “Database Manager – org.hsqldb.util” and you will see a window to enter the connection details:
Leave all the defaults, making sure that you enter the following:
Type: HSQL Database Engine In-Memory
Password: (leave blank)
THAT’S IT!!! You can now see how you can access the database where we will be inserting data. There is no need to create tables because we will have hibernate automatically create them in the next steps.
4. Shutdown the database server.
To shutdown the database server when you are finished using it, right click again on hsqldb-18.104.22.168.jar (inside “Referenced Libraries”) and select Run as … Java Application. Select “ShutdownServer – org.hsqldb.util”