public class RunScript extends Tool
| Constructor and Description |
|---|
RunScript() |
| Modifier and Type | Method and Description |
|---|---|
static ResultSet |
execute(Connection conn,
Reader reader)
Executes the SQL commands read from the reader against a database.
|
static void |
execute(String url,
String user,
String password,
String fileName,
String charsetName,
boolean continueOnError)
Executes the SQL commands in a script file against a database.
|
static void |
main(String... args)
Options are case sensitive.
|
void |
runTool(String... args)
Executes the contents of a SQL script file against a database.
|
isOption, printNoDatabaseFilesFound, setOut, showUsage, throwUnsupportedOptionpublic static void main(String... args) throws 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 |
| [-continueOnError] | Continue even if the script contains errors |
| [-options ...] | RUNSCRIPT options (embedded H2; -*Results not supported) |
args - the command line argumentsSQLExceptionpublic void runTool(String... args) throws 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.
runTool in class Toolargs - the command line argumentsSQLExceptionpublic static ResultSet execute(Connection conn, Reader reader) throws SQLException
conn - the connection to a databasereader - the readerSQLExceptionpublic static void execute(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws 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 occursSQLExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.