org.mentabean.util
Class ScriptRunner

java.lang.Object
  extended by org.mentabean.util.ScriptRunner

public class ScriptRunner
extends Object

Tool to run database scripts. This version of the script can be found at https://gist.github.com/gists/831762/


Constructor Summary
ScriptRunner(Connection conn)
           
ScriptRunner(Connection connection, boolean autoCommit, boolean stopOnError)
          Default constructor.
 
Method Summary
 void runScript(Reader reader)
          Runs an SQL script (read in using the Reader parameter).
 void setDelimiter(String delimiter, boolean fullLineDelimiter)
           
 void setErrorLogWriter(PrintWriter errorLogWriter)
          Setter for errorLogWriter property.
 void setLogWriter(PrintWriter logWriter)
          Setter for logWriter property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptRunner

public ScriptRunner(Connection connection,
                    boolean autoCommit,
                    boolean stopOnError)
Default constructor.

Parameters:
connection -
autoCommit -
stopOnError -

ScriptRunner

public ScriptRunner(Connection conn)
Method Detail

setDelimiter

public void setDelimiter(String delimiter,
                         boolean fullLineDelimiter)
Parameters:
delimiter -
fullLineDelimiter -

setLogWriter

public void setLogWriter(PrintWriter logWriter)
Setter for logWriter property.

Parameters:
logWriter - - the new value of the logWriter property

setErrorLogWriter

public void setErrorLogWriter(PrintWriter errorLogWriter)
Setter for errorLogWriter property.

Parameters:
errorLogWriter - - the new value of the errorLogWriter property

runScript

public void runScript(Reader reader)
               throws IOException,
                      SQLException
Runs an SQL script (read in using the Reader parameter).

Parameters:
reader - - the source of the script
Throws:
SQLException - if any SQL errors occur
IOException - if there is an error reading from the Reader


Copyright © 2013. All Rights Reserved.