Package com.ibatis.common.jdbc

Examples of com.ibatis.common.jdbc.ScriptRunner


    Connection conn = ds.getConnection();

    Reader reader = Resources.getResourceAsReader(script);

    ScriptRunner runner = new ScriptRunner(conn, false, false);
    runner.setLogWriter(null);
    runner.setErrorLogWriter(null);

    runner.runScript(reader);
    conn.commit();
    conn.close();
    reader.close();
  }
View Full Code Here


        } catch (SQLException e) {
            LOG.warning("The create tables parameter has not been set. Tables and indexes will not be created.");
            createTables = false;
        }
        if (createTables) {
            ScriptRunner sr = new ScriptRunner(dataSource.getConnection(), false, false);
            sr.setLogWriter(null);
            sr.setErrorLogWriter(null);
            sr.runScript(new InputStreamReader(this.getClass().getResourceAsStream("/" + createSql)));
            if (createSqlInd != null && !createSqlInd.equals("")) {
                sr.runScript(new InputStreamReader(this.getClass().getResourceAsStream("/" + createSqlInd)));
            } else {
                LOG.warning("The script to create indexes has not been set. Indexes will not be created.");
            }
        }
    }
View Full Code Here

  public void initInternalDB() throws SQLException, IOException {

    Integer count = getJdbcTemplate().queryForObject( SELECT, Integer.class );
    if ( count == null || count == 1 ) {
      Connection con = this.getDataSource().getConnection();
      ScriptRunner runner = new ScriptRunner( con, true, true );
      runner.runScript( Resources.getResourceAsReader( "sql/createdb_h2.sql" ) );
    }
  }
View Full Code Here

TOP

Related Classes of com.ibatis.common.jdbc.ScriptRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.