Sunday, February 3, 2013

Standalone HSQL DB Setup

I have a project and have the schemas available. But I don't have an actual database setup yet. Now run HSQLDB in standalone mode from command line and load the tables and get going :-) What are the steps to do that?

          a. Download latest version of HSQLDB from http://hsqldb.org.

          b. Goto hsql db folder and create a file named server.properties with the following entries.
                  server.database.0=file:hsqldb/TechFes
                server.dbname.0=TechFes
          c. Once the JAVA_HOME and PATH variables are updated with the correct java location,
               execute this command from hsqldb folder where server.properties file is created
                 
                  >java -classpath lib/hsqldb.jar org.hsqldb.server.Server
                 
               NOTE: This command would create a folder hsqldb and create the files for TechFes database under that folder.
             
          d. Now we need to open the database with additional params to the above command.
         
                >java -classpath lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:hsqldb/TechFes --dbname.0 TechFes
               
             NOTE: This would open the database so clients can connect to it.
            
          e. Now we can use the below command to launch the UI for this database and make changes to the schema.
         
                >java -cp lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing

No comments:

Post a Comment