Пример #1
0
 private void testBackup() throws SQLException {
   if (config.memory) {
     return;
   }
   deleteDb("openClose");
   String url = getURL("openClose", true);
   org.h2.Driver.load();
   Connection conn = DriverManager.getConnection(url, "sa", "abc def");
   Statement stat = conn.createStatement();
   stat.execute("CREATE TABLE TEST(C CLOB)");
   stat.execute("INSERT INTO TEST VALUES(SPACE(10000))");
   stat.execute("BACKUP TO '" + getBaseDir() + "/test.zip'");
   conn.close();
   deleteDb("openClose");
   Restore.execute(getBaseDir() + "/test.zip", getBaseDir(), null, true);
   conn = DriverManager.getConnection(url, "sa", "abc def");
   stat = conn.createStatement();
   ResultSet rs = stat.executeQuery("SELECT * FROM TEST");
   rs.next();
   assertEquals(10000, rs.getString(1).length());
   assertFalse(rs.next());
   conn.close();
   FileUtils.delete(getBaseDir() + "/test.zip");
 }