When running on localhost, this code base uses a temporary database built on a technology called H2.
An H2 database is not necessarly suitable for a production application; it may not handle concurrent access with good performance, for example. But for testing purposes, it’s just fine, and has some advantages:
The temporary database is stored in the target
directory, so any time you do a mvn clean
operation, that database is wiped away
so that you can start from scratch.
This is both good and bad; the key thing is to be aware of this.
It isn’t necessarily a course goal for you to become fully proficient in SQL (Structured Query Language, the language used to manipulate databases.)
But a little SQL can go a long way, and it can sometimes be helpful to peek under the hood at the database to see what’s going on.
When running on localhost, an H2-Console can be accessed from the menu bar.
When you click on H2-Console
, you get a page like this one:
The username/password are set in the file src/main/resources/application-development.properties
, for example:
spring.datasource.username=sa
spring.datasource.password=password`
Note that the value password
for a password is of course a terrible choice; but keep in mind that this is only for localhost testing,
which is by definition not avaiable on the public internet, so security here is not a primary concern. When deploying on Heroku, an entirely
different database system and password management system is in place.
Once you enter the username and password and press Connect, you may see a warning like this about the password password
, which is probably fine to ignore.
If it annoys you, perhaps choose a different random (but not one that you use for any other system!)
After that, you should see a page that looks like this. We will leave it to you to discover the things you can do here. An SQL tutorial may help; a good one can be found here: https://www.w3schools.com/sql/