Example usage for org.apache.ibatis.jdbc ScriptRunner setErrorLogWriter

List of usage examples for org.apache.ibatis.jdbc ScriptRunner setErrorLogWriter

Introduction

In this page you can find the example usage for org.apache.ibatis.jdbc ScriptRunner setErrorLogWriter.

Prototype

public void setErrorLogWriter(PrintWriter errorLogWriter) 

Source Link

Usage

From source file:org.mybatis.scripting.velocity.use.VelocityLanguageTest.java

License:Apache License

@BeforeClass
public static void setUp() throws Exception {
    Connection conn = null;/*ww  w . jav  a 2  s  . co m*/

    try {
        Class.forName("org.hsqldb.jdbcDriver");
        conn = DriverManager.getConnection("jdbc:hsqldb:mem:bname", "sa", "");

        Reader reader = Resources.getResourceAsReader("org/mybatis/scripting/velocity/use/CreateDB.sql");

        ScriptRunner runner = new ScriptRunner(conn);
        runner.setLogWriter(null);
        runner.setErrorLogWriter(null);
        runner.runScript(reader);
        conn.commit();
        reader.close();

        reader = Resources.getResourceAsReader("org/mybatis/scripting/velocity/use/MapperConfig.xml");
        sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
        reader.close();
    } finally {
        if (conn != null) {
            conn.close();
        }
    }
}