Here you can find the source of removeUnitDB()
public static void removeUnitDB()
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class Main { public static void removeUnitDB() { try {/*from w w w . ja va 2 s.co m*/ // shut down embedded database connection if there is one. DriverManager.getConnection("jdbc:derby:memory:flexims;drop=true", "flexims", "123456"); } catch (SQLException e) { // ignore } // // // avoid table created from other test // // FileUtils.deleteQuietly(new File("target/flexims")); // if (new File("target/flexims").exists()) { // throw new RuntimeException("database exists. It can not be deleted"); // } } public static Connection getConnection() throws SQLException { return getDerbyUnitConnection(); } public static Connection getDerbyUnitConnection() throws SQLException { String url = "jdbc:derby:memory:flexims;create=true"; Properties props = new Properties(); props.setProperty("user", "flexims"); props.setProperty("password", "123456"); return DriverManager.getConnection(url, props); } }