这样的事情应该工作
Server server = null; try { server = Server.createTcpServer("-tcpAllowOthers").start(); Class.forName("org.h2.Driver"); Connection conn = DriverManager. getConnection("jdbc:h2:tcp://localhost/~/stackoverflow", "sa", ""); System.out.println("Connection Established: " + conn.getmetaData().getDatabaseProductName() + "/" + conn.getCatalog()); } catch (Exception e) { e.printStackTrace();并且输出是已建立的连接:H2 / STACKOVERFLOW
已通过h2-1.4.184测试



