我想使用 HyperSQL 作为内存数据库来进行 Java - JDBC 应用程序的集成测试。
如果我尝试以下操作:
Properties props = new Properties();
props.put("user", "sa");
props.put("password", "");
Class.forName("org.hsqldb.jdbcDriver");
Connection cn = DriverManager.getConnection("jdbc:hsqldb:mem://localhost", props);
Statement st = cn.createStatement();
st.executeUpdate("Insert into foo (bar) values (10);");
我得到:
java.sql.SQLException: Table not found: foo in statement [Insert into bar]
我认为 HSQL 有一种方法可以在用作内存数据库时动态生成表,但我似乎在文档中找不到它。