简体   繁体   中英

Embedded database in Java EE application

Good day. I'm confused about storing the embedded database in a Java EE application. I've just resolved the problem with the .properties file which can be accessed via getResource method, but where should I put my database to support portability?

For portability, the appropriate way is to install the embedded database in the project directory & then specifying the relative path.

In general, you have to extract the content & specifying that path relative to the current directory as database url. Below are some examples.

  • H2 Database - jdbc:h2:file:relative-database-path
  • Apache Derby - By including required jars in classpath & configuring environment variable accordingly.
  • HSQLDB - jdbc:hsqldb:file:relative-database-path

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM