[ https://issues.apache.org/jira/browse/DERBY-3217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544779 ]
John H. Embretsen commented on DERBY-3217: ------------------------------------------ As far as I can see, there is no documented way to shut down the Derby engine when you are using a DataSource (I've only looked at EmbeddedSimpleDataSource (used for Java ME) and EmbeddedDataSource). However, I found that it is actually possible, by first setting the databaseName to the empty String, then setting the connection attribute "shutdown=true", and finally trying to obtain a connection. The exception is the same as I get when shutting down the engine using DriverManager. // Create an EmbeddedSimpleDataSource, setDatabaseName, setCreateDatabase, getConnection... try { derbyDs.setDatabaseName(""); derbyDs.setConnectionAttributes("shutdown=true"); System.out.println("Shutting down engine...?"); derbyDs.getConnection(); } catch (SQLException ex) { do { System.err.println("----- SQLException -----"); System.err.println("SQLState: " + ex.getSQLState()); System.err.println("Error code: " + ex.getErrorCode()); //ex.printStackTrace(); ex = ex.getNextException(); } while (ex != null); } } To restart the engine, create a new datasource object and set the correct databaseName, then getConnection(). It seems that the engine is started on the first call to getConnection(). The test harness is a bit more complicated (less direct) in the way it sets DataSource properties, but it should be possible to implement something like this there as well, if needed. > ErrorStreamTest failing on ibm j9 jvm > ------------------------------------- > > Key: DERBY-3217 > URL: https://issues.apache.org/jira/browse/DERBY-3217 > Project: Derby > Issue Type: Bug > Components: Regression Test Failure > Affects Versions: 10.4.0.0 > Environment: J9 - VM for the Java(TM) platform, Version 2.3 > (c) Copyright IBM Corp. 1991, 2006 All Rights Reserved > Target: 20061023_08962_lHdSMR (Windows XP 5.1 build 2600 Service Pack 2 x86) > JIT - 20060629_1804ifx1_r8 > Reporter: Mike Matrigali > Assignee: Vemund Østgaard > > Getting the following junit tests failures on just on the j9 jvm platform > running on windows: > There were 11 failures: > 1) > testDefault(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testDefault(ErrorStreamTest.java:128) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 2) > testFile(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testFile(ErrorStreamTest.java:141) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 3) > testWrongFile(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testWrongFile(ErrorStreamTest.java:160) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 4) > testMethod(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testMethod(ErrorStreamTest.java:179) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 5) > testWrongMethod(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testWrongMethod(ErrorStreamTest.java:198) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 6) > testField(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testField(ErrorStreamTest.java:217) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 7) > testWrongField(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testWrongField(ErrorStreamTest.java:236) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 8) > testFileOverMethod(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testFileOverMethod(ErrorStreamTest.java:257) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 9) > testFileOverField(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testFileOverField(ErrorStreamTest.java:278) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 10) > testFileOverMethodAndField(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testFileOverMethodAndField(ErrorStreamTest.java:302) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) > 11) > testMethodOverField(org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest)junit.framework.AssertionFailedError: > shutdown engine not implemened > at > org.apache.derbyTesting.junit.DataSourceConnector.shutEngine(DataSourceConnector.java:130) > at > org.apache.derbyTesting.junit.TestConfiguration.shutdownEngine(TestConfiguration.java:1091) > at > org.apache.derbyTesting.functionTests.tests.engine.ErrorStreamTest.testMethodOverField(ErrorStreamTest.java:326) > at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205) > at <unknown class>.<unknown method>(Unknown Source) > at > org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.