Пример #1
1
 private static ScriptRunner newScriptRunner(Connection connection) {
   ScriptRunner scriptRunner = new ScriptRunner(connection);
   scriptRunner.setDelimiter(";");
   scriptRunner.setStopOnError(true);
   scriptRunner.setLogWriter(new PrintWriter(new NullWriter()));
   return scriptRunner;
 }
 private static void runReaderScript(Connection conn, SqlSession session, Reader reader)
     throws Exception {
   ScriptRunner runner = new ScriptRunner(conn);
   runner.setLogWriter(null);
   runner.setSendFullScript(true);
   runner.setAutoCommit(true);
   runner.setStopOnError(false);
   runner.runScript(reader);
 }
Пример #3
0
 public static void runScript(DataSource ds, String resource) throws IOException, SQLException {
   Connection connection = ds.getConnection();
   try {
     ScriptRunner runner = new ScriptRunner(connection);
     runner.setAutoCommit(true);
     runner.setStopOnError(false);
     runner.setLogWriter(null);
     runner.setErrorLogWriter(null);
     runScript(runner, resource);
   } finally {
     connection.close();
   }
 }