简体   繁体   中英

H2 database storage mechanism

I have used H2 database for my junit tests and it works perfectly fine. However, I have few questions regarding it's persistence properties:

  1. What happens when I switch off my laptop? Are the tables and data lost in case of any restart? If yes, is there any restore possible?
  2. Does H2 uses transaction logs to persist the data to a disk? I can see a database file created in my users directory. Can I replicate the data into another system using this file?
  3. Can a persistence/storage mechanism configured with H2?

See the H2 Features page.

Brief summary regarding your questions:

  • H2 can be configured to use either in-memory or disk-based persistence. Depending on your choice it will or will not survive power shutdown.
  • The transaction support is READ COMMITTED .
  • You can copy and reuse the file, I would not call this that data replication in the classical sense. But if you have two H2 databases one goes down f.ex. you can copy the file from the other and boot it up.

Check also the High Availability fpr H2 Database project.

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