Showing posts with label H2 database. Show all posts
Showing posts with label H2 database. Show all posts

Start the H2 database in server mode via Spring

Start the H2 database in server mode via Spring

<bean id="org.h2.tools.Server" class="org.h2.tools.Server"
    factory-method="createTcpServer" init-method="start" destroy-method="stop">
    <constructor-arg value="-tcp,-tcpAllowOthers,true,-tcpPort,8043" />
    </bean>

    <bean id="org.h2.tools.Server-WebServer" class="org.h2.tools.Server"
    factory-method="createWebServer" init-method="start">
    <constructor-arg value="-web,-webAllowOthers,true,-webPort,8082" />
    </bean>
<beans default-lazy-init="true" ...
import org.h2.tools.Server;
...
// start the TCP Server
Server server = Server.createTcpServer(args).start();
...
// stop the TCP Server
server.stop();


Start the H2 database in server mode via Spring