Package org.h2.tools
Class Restore
java.lang.Object
org.h2.util.Tool
org.h2.tools.Restore
Restores a H2 database by extracting the database files from a .zip file.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Restores database files.private static String
getDatabaseNameFromFileName
(String fileName) Extract the name of the database from a given file name.private static String
getOriginalDbName
(String fileName, String db) static void
Options are case sensitive.void
Run the tool with the given output stream and arguments.Methods inherited from class org.h2.util.Tool
isOption, printNoDatabaseFilesFound, setOut, showUsage, showUsageAndThrowUnsupportedOption, throwUnsupportedOption
-
Constructor Details
-
Restore
public Restore()
-
-
Method Details
-
main
Options are case sensitive. Supported optionsSupported 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:
SQLException
- on failure
-
runTool
Description copied from class:Tool
Run the tool with the given output stream and arguments.- Specified by:
runTool
in classTool
- Parameters:
args
- the argument list- Throws:
SQLException
- on failure
-
getOriginalDbName
- Throws:
IOException
-
getDatabaseNameFromFileName
Extract the name of the database from a given file name. Only files ending with .h2.db are considered, all others return null.- Parameters:
fileName
- the file name (without directory)- Returns:
- the database name or null
-
execute
Restores database files.- Parameters:
zipFileName
- the name of the backup filedirectory
- the directory namedb
- the database name (null for all databases)- Throws:
DbException
- if there is an IOException
-