Class Migrate


  • public class Migrate
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      Migrate()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(java.io.File file, boolean recursive, java.lang.String user, java.lang.String password, boolean runQuiet)
      Migrate a database.
      static void main​(java.lang.String... args)
      Migrate databases.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Migrate

        public Migrate()
    • Method Detail

      • main

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

        public void execute​(java.io.File file,
                            boolean recursive,
                            java.lang.String user,
                            java.lang.String password,
                            boolean runQuiet)
                     throws java.lang.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:
        java.lang.Exception - if conversion fails