How to shutdown Derby in-memory database Properly

后端 未结 3 1454
一个人的身影
一个人的身影 2020-12-28 19:24

I\'m using derby as an embedded database. Furthermore, I\'m using it\'s in-memory database option for my unit tests.

What I can\'t figure out is how to properly shu

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-28 20:19

    The URL "jdbc:derby:memory:eh;shutdown=true" results in the expected 08006 error code, but doesn't actually remove the DB from memory. If later on, you try to create a new database with "jdbc:derby:memory:eh;create=true", you'll get an error saying that the database already exists.

    Fortunately, as of Derby 10.6.1.0 (released on May 17, 2010), it is possible to actually drop an in-memory database using a URL of the form "jdbc:derby:memory:eh;drop=true". See the release notes and the page Using in-memory databases.

提交回复
热议问题