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.
Fields inherited from class org.h2.util.Tool |
out |
Method Summary |
static void |
execute(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.io.OutputStream out)
Backs up a database to a stream. |
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 |
runTool(java.lang.String... args)
Run the tool with the given output stream and arguments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Script
public Script()
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
runTool
public void runTool(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:
runTool
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 URLuser
- the user namepassword
- the passwordfileName
- the script file
- Throws:
java.sql.SQLException
execute
public static void execute(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.io.OutputStream out)
throws java.sql.SQLException
- Backs up a database to a stream. The stream is not closed.
- Parameters:
url
- the database URLuser
- the user namepassword
- the passwordout
- the output stream
- Throws:
java.sql.SQLException