Package com.ibatis.common.jdbc
Class ScriptRunner
java.lang.Object
com.ibatis.common.jdbc.ScriptRunner
Tool to run database scripts.
-
Constructor Summary
ConstructorDescriptionScriptRunner
(String driver, String url, String username, String password, boolean autoCommit, boolean stopOnError) Instantiates a new script runner.ScriptRunner
(Connection connection, boolean autoCommit, boolean stopOnError) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Runs an SQL script (read in using the Reader parameter).void
setDelimiter
(String delimiter, boolean fullLineDelimiter) Sets the delimiter.void
setErrorLogWriter
(PrintWriter errorLogWriter) Setter for errorLogWriter property.void
setLogWriter
(PrintWriter logWriter) Setter for logWriter property.
-
Constructor Details
-
ScriptRunner
Default constructor.- Parameters:
connection
- the connectionautoCommit
- the auto commitstopOnError
- the stop on error
-
ScriptRunner
public ScriptRunner(String driver, String url, String username, String password, boolean autoCommit, boolean stopOnError) Instantiates a new script runner.- Parameters:
driver
- the driverurl
- the urlusername
- the usernamepassword
- the passwordautoCommit
- the auto commitstopOnError
- the stop on error
-
-
Method Details
-
setDelimiter
Sets the delimiter.- Parameters:
delimiter
- the delimiterfullLineDelimiter
- the full line delimiter
-
setLogWriter
Setter for logWriter property.- Parameters:
logWriter
- - the new value of the logWriter property
-
setErrorLogWriter
Setter for errorLogWriter property.- Parameters:
errorLogWriter
- - the new value of the errorLogWriter property
-
runScript
Runs an SQL script (read in using the Reader parameter).- Parameters:
reader
- - the source of the script- Throws:
IOException
- Signals that an I/O exception has occurred.SQLException
- the SQL exception
-