labs / tiddlers / content / labs / lab05 / _Labs_05_Create the

We will be using a DBMS named H2. It is a fully featured open source relational DBMS that is easy to install, configure, and use. It is written in Java, so runs on all of the platforms that we need in INFO202 (Windows, macOS, and Linux). You can read more about H2 at:

Since we are using JDBC, the only real prerequisite for which DBMS we use is that it has a JDBC driver and supports standard SQL.

  1. Download H2 from Blackboard (in the <

    Labs > H2 DBMS">> section).

    There are three versions there:

    • h2-linux.tgz --- For Linux machines including the InfoSci Linux desktop.

    • --- For Windows machines, including the Windows student desktop.

    • h2-mac.tgz --- For Macs.

    This is the latest version of H2 (as at week 5). We have added some start-up scripts to configure the location that H2 will store the DB files, and disabled the default main class so that you don't accidentally double click the JAR file and end up with something that doesn't work correctly. Please use the versions we have provided rather than downloading your own from the H2 web site.

  2. Extract the archive file somewhere appropriate.

    Please don't put it in your Git repository. You can always download a copy from Blackboard so there is no need to also store a copy in GitBucket. You want to keep your Git repositories 'lean and mean' so that Git operations are fast. We have in the past seen some desktop virus scanners prevent clone and pull operations from completing due to attempting to scan JAR files as they are being downloaded --- it is best if you can keep these files out of your repositories.

  3. Start H2 by running the appropriate start-up script:

    • For Linux, use the <> file. This is a 'desktop' file that should allow you to run the script directly from the file manager. If that doesn't work then use a terminal to run the script.
      • Windows users should be able to use the <> file.

      • Mac users may be able to double click the <> file to launch it depending on how your computer is configured.

        If that doesn't work you will need to use the Open With feature by right clicking to open the <> file with Terminal. Once that is set up you should be able to double click the file to launch H2.

    You should notice a <> icon appear in your system tray. If you see this icon then the H2 server is running and you will be able to connect to any databases running on this server.

  4. Now we need to create a database. Right click the H2 icon in the system tray and select <


  5. Enter project for the Database path.

    Leave the Username as 'sa'.

    Enter 'sa' for the Password.

  6. Check the <> folder in your home folder. You should see a file with the name <> which is the file that will contain your database.

    If you are using Windows then the <> folder is in the root of your <> drive for personal computers or <> drive for the student desktop.

  7. Now we need to open the H2 web console so that we can interact with the database. Click the H2 icon in the system tray. You should see the H2 console appear in a web browser.

  8. In the JDBC URL field in the web console, enter:


    Also enter INFO202 Project into the Setting Name and click the <

    > button. This allows you to easily open this database from the console in the future.

  9. Enter the password sa and click <


    You should now be in the H2 console where you can examine the database and execute SQL statements. The database is currently empty so there isn't much to look at yet.

Note that the database only exists on the system that you are currently using --- if you are currently using the Linux desktop and you want to continue working on the project on your own laptop then you will need to perform these steps again on your laptop. If you do intend to do this then it would be a good idea to do it now so that you can get some help if things go wrong.