How to use H2 in Server Mode?

So this is what I have done..

First I added h2 db dependency to pom.xml..

and then the .jar file, h2-1.4.192.jar was in my maven repo, what a surprise.

Anyway, then I copied this jar to C:\Dev\h2.

I will just start the database as seen below from C:\Dev\h2
java -jar h2-1.3.160.jar -webAllowOthers -tcpAllowOthers

So when you do this, you can just go to and see your database actually. Anyway, I just typed jdbc:h2:~/h2dbs/studentform and connected to the database, since this db did not exists before, it is just created..

And then I just downloaded dbeaver. from here and created the tables I needed..

And in my application, this is what I did, I created a context.xml file under META-INF directory:
<?xml version='1.0' encoding='utf-8'?>
    <Resource name="jdbc/studentform" auth="Container" type="javax.sql.DataSource"
              maxActive="5" maxIdle="5" maxWait="10000"
              username="sa" password="" driverClassName="org.h2.Driver"

 And in web.xml I have:
    <description>DB Connection</description>

Finally just a sample code how I connect to db:
final Context ctx = new InitialContext();
final DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/studentform");
final Connection conn = ds.getConnection();
final Statement statement = conn.createStatement();
final String sql = "INSERT INTO STUDENT(FULLNAME) VALUES('" + fullname + "');";

So this is it!! h2 here acts just like mysql server actually.. I think it is pretty cool.