Top Description Fields Constructors Methods
org.h2.tools

public Class Backup

extends Tool
Class Inheritance
Imports
java.io.FileNotFoundException, .IOException, .InputStream, .OutputStream, java.sql.SQLException, java.util.List, java.util.zip.ZipEntry, .ZipOutputStream, org.h2.command.dml.BackupCommand, org.h2.engine.Constants, org.h2.message.DbException, org.h2.store.FileLister, org.h2.store.fs.FileUtils, org.h2.util.IOUtils, .Tool

Creates a backup of a database. This tool copies all database files. The database must be closed before using this tool. To create a backup while the database is in use, run the BACKUP SQL statement. In an emergency, for example if the application is not responding, creating a backup using the Backup tool is possible by using the quiet mode. However, if the database is changed while the backup is running in quiet mode, the backup could be corrupt.

Field Summary

Inherited from org.h2.util.Tool:
out

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
execute(String
the name of the target backup file (including path)
zipFileName
,
String
the source directory name
directory
,
String
the source database name (null if there is only one database, and empty string to backup all files in this directory)
db
,
boolean
don't print progress information
quiet
)

Backs up database files.

public static void
main(String...
the command line arguments
args
)

Options are case sensitive.

private void
process(String zipFileName, String directory, String db, boolean quiet)

public void
runTool(String...
the argument list
args
)

Implements abstract org.h2.util.Tool.runTool.

Run the tool with the given output stream and arguments.

Inherited from org.h2.util.Tool:
getMainClassNameisOptionprintNoDatabaseFilesFoundsetOutshowUsageshowUsageAndThrowUnsupportedOptionthrowUnsupportedOption

Constructor Detail

Backupback to summary
public Backup()

Method Detail

executeback to summary
public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException

Backs up database files.

Parameters
zipFileName:String

the name of the target backup file (including path)

directory:String

the source directory name

db:String

the source database name (null if there is only one database, and empty string to backup all files in this directory)

quiet:boolean

don't print progress information

Exceptions
SQLException:
on failure
mainback to summary
public static void main(String... args) throws SQLException

Options are case sensitive.

Supported options are:
[-help] or [-?] Print the list of options
[-file <filename>] The target file name (default: backup.zip)
[-dir <dir>] The source directory (default: .)
[-db <database>] Source database; not required if there is only one
[-quiet] Do not print progress information
Parameters
args:String[]

the command line arguments

Exceptions
SQLException:
on failure
processback to summary
private void process(String zipFileName, String directory, String db, boolean quiet) throws SQLException
runToolback to summary
public void runTool(String... args) throws SQLException

Implements abstract org.h2.util.Tool.runTool.

Doc from org.h2.util.Tool.runTool.

Run the tool with the given output stream and arguments.

Parameters
args:String[]

the argument list

Annotations
@Override
Exceptions
SQLException:
on failure