Java Code Examples for org.h2.tools.Server#createTcpServer()

The following examples show how to use org.h2.tools.Server#createTcpServer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: H2DatabaseTestResource.java    From quarkus-in-prod with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> start() {

    try {
        tcpServer = Server.createTcpServer();
        tcpServer.start();
        System.out.println("[INFO] H2 database started in TCP server mode on port " + tcpServer.getPort());
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
    return emptyMap();
}
 
Example 2
Source File: MainFrame.java    From e with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws SQLException {

        String[] arg = { "-tcp", "-tcpAllowOthers" };
        Server server = Server.createTcpServer(arg);
        server.start();
        new MainFrame().setVisible(true);

    }
 
Example 3
Source File: H2DatabaseTestResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> start() {

    try {
        tcpServer = Server.createTcpServer();
        tcpServer.start();
        System.out.println("[INFO] H2 database started in TCP server mode; server status: " + tcpServer.getStatus());
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
    return Collections.emptyMap();
}
 
Example 4
Source File: MicroServiceConsole.java    From e with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws SQLException {
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {

        @Override
        public void run() {
            killProcess();
        }
    }));

    String[] arg = { "-tcp", "-tcpAllowOthers" };
    Server server = Server.createTcpServer(arg);
    server.start();

    init();
}
 
Example 5
Source File: ExecuteSqlWorkItemHandlerTest.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public void start() {
    if (realH2Server == null || !realH2Server.isRunning(false)) {
        try {
            realH2Server = Server.createTcpServer(new String[0]);
            realH2Server.start();
            System.out.println("Started H2 Server...");
        } catch (SQLException e) {
            throw new RuntimeException("can't start h2 server db",
                                       e);
        }
    }
}
 
Example 6
Source File: JPAWorkItemHandlerTest.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public void start() {
    if (realH2Server == null || !realH2Server.isRunning(false)) {
        try {
            realH2Server = Server.createTcpServer(new String[0]);
            realH2Server.start();
            System.out.println("Started H2 Server...");
        } catch (SQLException e) {
            throw new RuntimeException("can't start h2 server db",
                                       e);
        }
    }
}
 
Example 7
Source File: H2TestEnricher.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public void startH2(@Observes(precedence = 3) BeforeSuite event) throws SQLException {
    if (runH2 && dockerDatabaseSkip) {
        log.info("Starting H2 database.");
        server = Server.createTcpServer();
        server.start();
        log.info(String.format("URL: %s", server.getURL()));
    }
}
 
Example 8
Source File: MainDb.java    From e with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws SQLException {

        String[] arg = { "-tcp", "-tcpAllowOthers" };
        Server server = Server.createTcpServer(arg);
        server.start();

		System.out.println("JVM running for");
    }
 
Example 9
Source File: MicroRegistry.java    From sample-boot-micro with MIT License 5 votes vote down vote up
/** テスト用途のメモリDBサーバ  */
@Bean(initMethod="start", destroyMethod = "stop")
@ConditionalOnProperty(prefix = "extension.test.db", name = "enabled", matchIfMissing = false)
Server h2Server() {
    try {
        return Server.createTcpServer("-tcpAllowOthers", "-ifNotExists", "-tcpPort", "9092");
    } catch (SQLException e) {
        throw new IllegalStateException(e);
    }
}
 
Example 10
Source File: H2Test.java    From x-pipe with Apache License 2.0 4 votes vote down vote up
protected void startH2Server() throws SQLException {

        Server tcpServer = Server.createTcpServer("-tcpPort", String.valueOf(h2Port), "-tcpAllowOthers");
        tcpServer.start();
    }
 
Example 11
Source File: SpringBootApp.java    From tutorials with MIT License 4 votes vote down vote up
@Bean(initMethod = "start", destroyMethod = "stop")
public Server inMemoryH2DatabaseServer() throws SQLException {
    return Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9091");
}
 
Example 12
Source File: DBServer.java    From kafka-streams-in-action with Apache License 2.0 4 votes vote down vote up
public static void startDatabaseServer() throws SQLException {
    h2Server = Server.createTcpServer("-tcp", "-tcpPort", "9989", "-tcpAllowOthers");
    h2Server.start();
}
 
Example 13
Source File: DatabaseConfiguration.java    From tutorials with MIT License 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 14
Source File: _DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 15
Source File: DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 16
Source File: DatabaseConfiguration.java    From OpenIoE with Apache License 2.0 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 17
Source File: DatabaseConfiguration.java    From klask-io with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 18
Source File: DatabaseConfiguration.java    From jhipster-microservices-example with Apache License 2.0 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 19
Source File: DatabaseConfiguration.java    From tutorials with MIT License 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}
 
Example 20
Source File: DatabaseConfiguration.java    From tutorials with MIT License 2 votes vote down vote up
/**
 * Open the TCP port for the H2 database, so it is available remotely.
 *
 * @return the H2 database TCP server
 * @throws SQLException if the server failed to start
 */
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Server h2TCPServer() throws SQLException {
    return Server.createTcpServer("-tcp","-tcpAllowOthers");
}