Package org.h2.tools

Examples of org.h2.tools.Server.start()


                  final String[] args = new String[] {
                      "-baseDir", dbPath.getAbsolutePath(),
                      "-tcpPort", String.valueOf(port),
                      "-tcpAllowOthers","" }; //  need the extra empty string or a exception is thrown by H2
                  final Server server = Server.createTcpServer(args) ;
                  server.start() ;
                  setRemoteServer(server);
              }
              catch (Exception e)
              {
                 log.error("Failed to start database", e);
View Full Code Here


    public void test() throws SQLException {
        deleteDb("test");
        Server server = Server.createPgServer("-baseDir", getBaseDir(), "-pgPort", "5535", "-pgDaemon");
        assertEquals(5535, server.getPort());
        assertEquals("Not started", server.getStatus());
        server.start();
        assertStartsWith(server.getStatus(), "PG server running at pg://");
        try {
            Class.forName("org.postgresql.Driver");
            testPgClient();
        } catch (ClassNotFoundException e) {
View Full Code Here

            } else {
                throwUnsupportedOption(arg);
            }
        }
        Server server = new Server(this, args);
        server.start();
        out.println(server.getStatus());
    }

    public void listen() {
        try {
View Full Code Here

        assertEquals(new String(new char[100000]), rs.getString(3));
    }

    private void testOldClientNewServer() throws Exception {
        Server server = org.h2.tools.Server.createTcpServer("-tcpPort", "9001");
        server.start();
        assertThrows(ErrorCode.DRIVER_VERSION_ERROR_2, driver).
                connect("jdbc:h2:tcp://localhost:9001/mem:test", null);
        server.stop();

        Class<?> serverClass = cl.loadClass("org.h2.tools.Server");
View Full Code Here

        server.start();
        assertTrue(server.getStatus().indexOf("server running") >= 0);
        Server server2 = Server.createWebServer("-webPort", "8182", "-properties", "null");
        assertEquals("Not started", server2.getStatus());
        try {
            server2.start();
            fail();
        } catch (Exception e) {
            assertTrue(e.toString().indexOf("port may be in use") >= 0);
            assertTrue(server2.getStatus().indexOf("could not be started") >= 0);
        }
View Full Code Here

        } finally {
            server.shutdown();
        }
        // it should be stopped now
        server = Server.createTcpServer("-tcpPort", "9101");
        server.start();
        server.stop();
    }

    private void testWebApp() throws Exception {
        Server server = new Server();
View Full Code Here

        }};
    }

    private void testAlreadyRunning() throws Exception {
        Server server = Server.createWebServer("-webPort", "8182", "-properties", "null");
        server.start();
        assertTrue(server.getStatus().indexOf("server running") >= 0);
        Server server2 = Server.createWebServer("-webPort", "8182", "-properties", "null");
        assertEquals("Not started", server2.getStatus());
        try {
            server2.start();
View Full Code Here

  public static void main(String[] args) {
   
    try {
      // start h2 in memory database
      Server server = Server.createWebServer(args);
      server.start();
      System.out.println("Start H2... " + server.getStatus());
    } catch (Throwable t) {
      throw new RuntimeException("Could not start H2 server", t);
    }
  }
View Full Code Here

                  final String[] args = new String[] {
                      "-baseDir", dbPath.getAbsolutePath(),
                      "-tcpPort", String.valueOf(port),
                      "-tcpAllowOthers","" }; //  need the extra empty string or a exception is thrown by H2
                  final Server server = Server.createTcpServer(args) ;
                  server.start() ;
                  setRemoteServer(server);
              }
              catch (Exception e)
              {
                 log.error("Failed to start database", e);
View Full Code Here

     */
    public static void main(String... args) throws Exception {

        // start the server, allows to access the database remotely
        Server server = Server.createTcpServer("-tcpPort", "9081");
        server.start();
        System.out.println("You can access the database remotely now, using the URL:");
        System.out.println("jdbc:h2:tcp://localhost:9081/~/test (user: sa, password: sa)");

        // now use the database in your application in embedded mode
        Class.forName("org.h2.Driver");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.