|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.Tool
org.h2.tools.RunScript
public class RunScript
Runs a SQL script against a database.
Field Summary |
---|
Fields inherited from class org.h2.util.Tool |
---|
out |
Constructor Summary | |
---|---|
RunScript()
|
Method Summary | |
---|---|
static java.sql.ResultSet |
execute(java.sql.Connection conn,
java.io.Reader reader)
Executes the SQL commands in a script file against a database. |
static void |
execute(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String fileName,
java.lang.String charsetName,
boolean continueOnError)
Executes the SQL commands in a script file against a database. |
static void |
main(java.lang.String... args)
Options are case sensitive. |
void |
run(java.lang.String... args)
Executes the contents of a SQL script file against a database. |
void |
setCheckResults(boolean check)
If results of statements should be cross-checked with the expected output. |
void |
setShowResults(boolean show)
If the statements as well as the results should be printed to the output. |
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 |
---|
public RunScript()
Method Detail |
---|
public static void main(java.lang.String... args) throws java.sql.SQLException
[-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 script file to run (default: backup.sql) |
[-driver <class>] | The JDBC driver class to use (not required in most cases) |
[-showResults] | Show the statements and the results of queries |
[-checkResults] | Check if the query results match the expected results |
[-options ...] | RUNSCRIPT options (embedded H2; -*Results not supported) |
args
- the command line arguments
java.sql.SQLException
public void run(java.lang.String... args) throws java.sql.SQLException
java -Xrunhprof:cpu=samples,depth=16 ...To include local files when using remote databases, use the special syntax:
@INCLUDE fileNameThis syntax is only supported by this tool. Embedded RUNSCRIPT SQL statements will be executed by the database.
run
in class Tool
args
- the command line arguments
java.sql.SQLException
public static java.sql.ResultSet execute(java.sql.Connection conn, java.io.Reader reader) throws java.sql.SQLException
conn
- the connection to a databasereader
- the reader
java.sql.SQLException
public static void execute(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String fileName, java.lang.String charsetName, boolean continueOnError) throws java.sql.SQLException
url
- the database URLuser
- the user namepassword
- the passwordfileName
- the script filecharsetName
- the character set name or null for UTF-8continueOnError
- if execution should be continued if an error occurs
java.sql.SQLException
public void setShowResults(boolean show)
show
- true if yespublic void setCheckResults(boolean check)
check
- true if yes
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |