Package org.h2.tools

# Class Script

java.lang.Object
org.h2.util.Tool
org.h2.tools.Script

public class Script extends Tool
Creates a SQL script file by extracting the schema and data of a database.

## Field Summary

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

`out`

## Constructor Summary

Constructors
Constructor
Description
`Script()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`main(String... args)`
Options are case sensitive.
`static void`
`process(String url, String user, String password, String fileName, String options1, String options2)`
Backs up a database to a stream.
`static void`
`process(Connection conn, String fileName, String options1, String options2)`
Backs up a database to a stream.
`void`
`runTool(String... args)`
Run the tool with the given output stream and arguments.

### Methods inherited from class org.h2.util.Tool

`getMainClassName, 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 Details

### Script

public Script()

## Method Details

### main

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` - the command line arguments
Throws:
  `SQLException` - on failure

### runTool

public void runTool(String... args) throws SQLException
Description copied from class: `Tool`
Run the tool with the given output stream and arguments.

Specified by:
  `runTool` in class `Tool`
Parameters:
  `args` - the argument list
Throws:
  `SQLException` - on failure

### process

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` - the database URL
  `user` - the user name
  `password` - the password
  `fileName` - the target file name
  `options1` - the options before the file name (may be an empty string)
  `options2` - the options after the file name (may be an empty string)
Throws:
  `SQLException` - on failure

### process

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` - the connection
  `fileName` - the target file name
  `options1` - the options before the file name
  `options2` - the options after the file name
Throws:
  `SQLException` - on failure