I got an exception below when trying to use derby in memory database in JUNITTEST.
java.sql.SQLNonTransientConnectionException: Database 'memory:testDB' dropped. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
@Before
public void setUp() throws Exception {
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
String connectionURL = "jdbc:derby:memory:testDB;create=true";
Class.forName(driver);
Connection conn = DriverManager.getConnection(connectionURL);
super.setUp();
}
@After
public void tearDown() throws Exception {
String connectionURL = "jdbc:derby:memory:testDB;drop=true";
DriverManager.getConnection(connectionURL);
}