org.h2.tools
Class Script

java.lang.Object
  extended by org.h2.util.Tool
      extended by 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
Script()
           
 
Method Summary
static void execute(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String fileName)
          Backs up a database to a SQL script file.
static void main(java.lang.String... args)
          Options are case sensitive.
 void run(java.lang.String... args)
          Run the tool with the given output stream and arguments.
 
Methods inherited from class org.h2.util.Tool
printNoDatabaseFilesFound, readArgBoolean, setOut, showUsage, throwUnsupportedOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Script

public Script()
Method Detail

main

public static void main(java.lang.String... args)
                 throws java.sql.SQLException
Options are case sensitive. Supported options are:
[-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 RUNSCRIPT)
[-quiet] Do not print progress information

Parameters:
args - the command line arguments
Throws:
java.sql.SQLException

run

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

Specified by:
run in class Tool
Parameters:
args - the argument list
Throws:
java.sql.SQLException

execute

public static void execute(java.lang.String url,
                           java.lang.String user,
                           java.lang.String password,
                           java.lang.String fileName)
                    throws java.sql.SQLException
Backs up a database to a SQL script file.

Parameters:
url - the database URL
user - the user name
password - the password
fileName - the script file
Throws:
java.sql.SQLException