Package org.h2.tools

Class Restore


  • public class Restore
    extends org.h2.util.Tool
    Restores a H2 database by extracting the database files from a .zip file.
    • Field Summary

      • Fields inherited from class org.h2.util.Tool

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      Restore()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void execute​(java.lang.String zipFileName, java.lang.String directory, java.lang.String db)
      Restores database files.
      static void main​(java.lang.String... args)
      Options are case sensitive.
      void runTool​(java.lang.String... args)
      Run the tool with the given output stream and arguments.
      • Methods inherited from class org.h2.util.Tool

        isOption, printNoDatabaseFilesFound, setOut, showUsage, showUsageAndThrowUnsupportedOption, throwUnsupportedOption
      • Methods inherited from class java.lang.Object

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

      • Restore

        public Restore()
    • Method Detail

      • main

        public static void main​(java.lang.String... args)
                         throws java.sql.SQLException
        Options are case sensitive. Supported options
        Supported options
        [-help] or [-?] Print the list of options
        [-file <filename>] The source file name (default: backup.zip)
        [-dir <dir>] The target directory (default: .)
        [-db <database>] The target database name (as stored if not set)
        [-quiet] Do not print progress information
        Parameters:
        args - the command line arguments
        Throws:
        java.sql.SQLException - on failure
      • runTool

        public void runTool​(java.lang.String... args)
                     throws java.sql.SQLException
        Description copied from class: org.h2.util.Tool
        Run the tool with the given output stream and arguments.
        Specified by:
        runTool in class org.h2.util.Tool
        Parameters:
        args - the argument list
        Throws:
        java.sql.SQLException - on failure
      • execute

        public static void execute​(java.lang.String zipFileName,
                                   java.lang.String directory,
                                   java.lang.String db)
        Restores database files.
        Parameters:
        zipFileName - the name of the backup file
        directory - the directory name
        db - the database name (null for all databases)
        Throws:
        org.h2.message.DbException - if there is an IOException