Class Migrate

java.lang.Object
org.h2.dev.util.Migrate

public class Migrate extends Object
Migrate a H2 database version 1.1.x (page store not enabled) to 1.2.x (page store format). This will download the H2 jar file version 1.2.127 from maven.org if it doesn't exist, execute the Script tool (using Runtime.exec) to create a backup.sql script, rename the old database file to *.backup, created a new database (using the H2 jar file in the class path) using the Script tool, and then delete the backup.sql file. Most utility methods are copied from h2/src/tools/org/h2/build/BuildBase.java.
  • Constructor Details

    • Migrate

      public Migrate()
  • Method Details

    • main

      public static void main(String... args) throws Exception
      Migrate databases. The user name and password are both "sa".
      Parameters:
      args - the path (default is the current directory)
      Throws:
      Exception - if conversion fails
    • execute

      public void execute(File file, boolean recursive, String user, String password, boolean runQuiet) throws Exception
      Migrate a database.
      Parameters:
      file - the database file (must end with .data.db) or directory
      recursive - if the file parameter is in fact a directory (in which case the directory is scanned recursively)
      user - the user name of the database
      password - the password
      runQuiet - to run in quiet mode
      Throws:
      Exception - if conversion fails