Top Description Fields Constructors Methods
org.h2.tools

public Class Script

extends Tool
Class Inheritance
Imports
java.sql.Connection, .SQLException, .Statement, org.h2.util.JdbcUtils, .StringUtils, .Tool

Creates a SQL script file by extracting the schema and data of a database.

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
main(String...
the command line arguments
args
)

Options are case sensitive.

public static void
process(String
the database URL
url
,
String
the user name
user
,
String
the password
password
,
String
the target file name
fileName
,
String
the options before the file name (may be an empty string)
options1
,
String
the options after the file name (may be an empty string)
options2
)

Backs up a database to a stream.

public static void
process(Connection
the connection
conn
,
String
the target file name
fileName
,
String
the options before the file name
options1
,
String
the options after the file name
options2
)

Backs up a database to a stream.

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

Scriptback to summary
public Script()

Method Detail

mainback to summary
public static void main(String... args) throws SQLException

Options are case sensitive.

Supported options
[-help] or [-?] Print the list of options
[-url "<url>"] The database URL (jdbc:...)
[-user <user>] The user name (default: sa)
[-password <pwd>] The password
[-script <file>] The target script file name (default: backup.sql)
[-options ...] A list of options (only for embedded H2, see SCRIPT)
[-quiet] Do not print progress information
Parameters
args:String[]

the command line arguments

Exceptions
SQLException:
on failure
processback to summary
public static void process(String url, String user, String password, String fileName, String options1, String options2) throws SQLException

Backs up a database to a stream.

Parameters
url:String

the database URL

user:String

the user name

password:String

the password

fileName:String

the target file name

options1:String

the options before the file name (may be an empty string)

options2:String

the options after the file name (may be an empty string)

Exceptions
SQLException:
on failure
processback to summary
public static void process(Connection conn, String fileName, String options1, String options2) throws SQLException

Backs up a database to a stream. The stream is not closed. The connection is not closed.

Parameters
conn:Connection

the connection

fileName:String

the target file name

options1:String

the options before the file name

options2:String

the options after the file name

Exceptions
SQLException:
on failure
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