Java Tutorial - Java Script : Installing and Running HSqlDb

Java Tutorial - Java Script :

Installing and Running HSqlDb


HSqlDb is installed simply by downloading and decompressing the binary distribution file. HSqlDb provides a manager utility that can be used test the database installation. From the data subdirectory, launch the HSqlDb Manager application using the following command: java -classpath ..\lib\hsqldb.jar org.hsqldb.util.DatabaseManager
The dialog box shown in Figure 8.3 prompts you for the database connection information. The default arguments create a temporary memory-based database. Replacing the URL string with jdbc:hsqldb:hsqltest, as shown in the figure creates (or opens if the database has already been created) a database named “hsqltest” in the current directory. The manager application is a useful tool and can be used with other JDBCsupported databases as well. The tool provides a means to quickly generate a test database by choosing Options Insert Test Data. After this has been done, the manager application shows the structure of the database in the left pane, as shown in Figure 8.4.

Figure 8.3 HSqlDb manager application Connect dialog box.Figure 8.4 HSqlDb manager application

The manager application provides a tool for building and executing database commands. The results are displayed in the pane on the right side below the text box that allows entering and editing commands. Entering the following SQL command and clicking the Execute button displays a list of the test data loaded into the customer database.
SELECT * FROM CUSTOMER