This is related to this post.
I think I am having problem with H2
meaning that it does not close properly.
I suspect this since I see myDB.lock.db
By looking at the DbStarter.contextDestroyed()'s code (thanks to Allan5's answer), here is the code that will work:
connection.createStatement().execute("SHUTDOWN");
So Aaron Digulla's answer was correct (even if not fully "copy/pastable").
Moreover, if you have started an H2 TCP server using server = Server.createTcpServer("-tcpAllowOthers")
, you can stop it simply using server.stop()
.