I am trying to share an in-memory H2 Database I created using SORM framework in my Play Framework application. Below is the code for my database code
object DB extends Instance(entities = Seq(Entity[Person]()), url ="jdbc:h2:mem:db1"){}
The solution stated at H2 Database site is to start a TCP Server. In Java applications I am able to share the database using the following code
org.h2.tools.Server server = org.h2.tools.Server.createTcpServer();
server.start();
Connection conn = DriverManager.getConnection("jdbc:h2:mem:db1");
How can I start a tcp server in my Play application when it starts or when it is running?
From playframework documentation, you should be able to place the code in onStart function.