Java Code Examples for org.apache.ibatis.jdbc.ScriptRunner#setErrorLogWriter()
The following examples show how to use
org.apache.ibatis.jdbc.ScriptRunner#setErrorLogWriter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultResultHandlerTypeTest.java From mybaties with Apache License 2.0 | 6 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources .getResourceAsReader("org/apache/ibatis/submitted/result_handler_type/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 2
Source File: ParametrizedListTest.java From mybatis with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:parametrizedlist", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/parametrizedlist/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(new PrintWriter(System.err)); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/parametrizedlist/Config.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 3
Source File: LanguageTest.java From mybatis with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUp() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:language", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/language/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/language/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 4
Source File: CamelCaseMappingTest.java From mybaties with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUp() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:gname", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/camelcase/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/camelcase/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 5
Source File: PrimitiveResultTypeTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void setup() throws Exception { SqlSession session = IbatisConfig.getSession(); Connection conn = session.getConnection(); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/primitive_result_type/create.sql"); runner.runScript(reader); }
Example 6
Source File: ResultMapExtendsTest.java From mybatis with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 7
Source File: ReverseIncludeTest.java From mybaties with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 8
Source File: ComplexColumnTest.java From mybaties with Apache License 2.0 | 5 votes |
@BeforeClass public static void initDatabase() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:complex_column", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/complex_column/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/complex_column/ibatisConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 9
Source File: DynSqlTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void setUp() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:bname", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/dynsql2/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/dynsql2/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 10
Source File: SPTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void initDatabase() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:sptest", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/sptests/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setDelimiter("go"); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/sptests/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 11
Source File: SelectKeyTest.java From mybatis with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:lname", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/selectkey/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/selectkey/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); sqlSessionFactory.getConfiguration().addMapper(AnnotatedMapper.class); } finally { if (conn != null) { conn.close(); } } }
Example 12
Source File: MultipleReverseIncludeTest.java From mybatis with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 13
Source File: ParameterMapReferenceTest.java From mybaties with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 14
Source File: CglibNPELazyTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void initDatabase() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:cglib_lazy_error", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/cglib_lazy_error/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/cglib_lazy_error/ibatisConfigLazy.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); sqlSessionFactory.getConfiguration().setLazyLoadingEnabled(true); sqlSessionFactory.getConfiguration().setAggressiveLazyLoading(false); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 15
Source File: ResultMapReferenceTest.java From mybatis with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 16
Source File: BlobTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void initDatabase() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:blobtest", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/blobtest/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/blobtest/MapperConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 17
Source File: CglibNPETest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void initDatabase() throws Exception { Connection conn = null; try { Class.forName("org.hsqldb.jdbcDriver"); conn = DriverManager.getConnection("jdbc:hsqldb:mem:cglib_lazy_eager_no_error", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/cglib_lazy_error/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(reader); conn.commit(); reader.close(); reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/cglib_lazy_error/ibatisConfig.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 18
Source File: XmlExternalRefTest.java From mybaties with Apache License 2.0 | 5 votes |
private static void initDb(Connection conn) throws IOException, SQLException { try { Reader scriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); runner.runScript(scriptReader); conn.commit(); scriptReader.close(); } finally { if (conn != null) { conn.close(); } } }
Example 19
Source File: ComponentTest.java From mybatis with Apache License 2.0 | 5 votes |
private static void runDBScript() throws SQLException, IOException { Connection conn = sqlSessionFactory.getConfiguration().getEnvironment().getDataSource().getConnection(); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); String resource = "org/apache/ibatis/submitted/complex_property/db.sql"; Reader reader = Resources.getResourceAsReader(resource); runner.runScript(reader); conn.close(); }
Example 20
Source File: FooMapperTest.java From mybatis with Apache License 2.0 | 5 votes |
@BeforeClass public static void setUpBeforeClass() { try { final SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(SQL_MAP_CONFIG)); session = factory.openSession(); Connection conn = session.getConnection(); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.setErrorLogWriter(null); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/null_associations/create-schema-mysql.sql"); runner.runScript(reader); } catch (Exception ex) { ex.printStackTrace(); } }