Setting up h2 database is the easiest job to do. First download the zip file, unzip the same. I have already done the same thing and the h2 folder after unzipping is there in my home directory here. Under that, you will see that there is a bin directory that contains all the important files. Number one you see here is a jar file. This consists of type for JDBC driver.
It has a HTTP server application, and it has got couple of client applications as well. On Windows, you have to double click this h2 dot bat to start the h2 database server. On Mac and Linux, we have to run this h2 dot sh file. To do so I'm just going to copy the part and then open a new terminal here. And then I paste this press enter and that runs the h2 database server as well as it opens a client application that connects to the h2 database server. On Windows on the taskbar, you should see an icon like this, which actually allows us to view the status or shut down the server or get this particular console screen.
Once again, by default, you may see that it would be showing generic h2 embedded. Make sure that you select hitch to server, you can change the name if you want, and then save it for further use. The driver class remains the same thing or dot history dot driver that is a type four driver from its to the JDBC URL. You may see something like test over here. But you can change this to what are the new database name that you want to create. For example, I want to call this as hibernate quickstart.
Username can be anything you want. I leave that as a for system admin. The password is blank. You can click on the test connection to see if everything is okay. Hey To checks if this database exists, if it exists, it will try to connect. If it does not exist, it's going to create a new one.
I click on Test Connection, it says test successful. I click on Connect, and it now connects. This is where you can issue any kind of SQL commands, like DDL DML or any others. In order to disconnect this client, you can click on this icon that gets disconnected and you will see this client application again, in case if the browser is closed, and if you want to open again, you can go to this h2 icon over here and then click on h2 console, it will bring the screen back. It remembers the previous database that has been connected with the username, password, etc. So I can click on this connect and I will be taken into my database.
And this is where all the tables will be listed as we go forward.