We are developing new Genealogy solution based on Java and H2 database. Hibernate ORM seems to be a promising as alternative to manual handling of database with ResultSet. However all examples I have seen with H2 and hibernate use “in Memory” H2 database option. Out solution use H2 as ordinary embedded H2 database stored in the filesystem.
Qestion: Need the H2 database to run in “in Memory” mode when used with Hibernate?
No, you don’t have to. That’s unrelated to Hibernate ORM, by the way: this is a configuration option of H2; you’ll simply use a different JDBC URL depending on where you want H2 to store its data.
See in particular the H2 documentation:
Embedded
jdbc:h2:~/test
‘test’ in the user home directory
jdbc:h2:/data/test
‘test’ in the directory /data
jdbc:h2:./test
in the current(!) working directoryIn-Memory
jdbc:h2:mem:test
multiple connections in one process, database is removed when all connections are closed
jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
multiple connections in one process, database in not removed when all connections are closed (may create a memory leak)
jdbc:h2:mem:
unnamed private; one connectionServer Mode
jdbc:h2:tcp://localhost/~/test
user home dir
jdbc:h2:tcp://localhost//data/test
orjdbc:h2:tcp://localhost/D:/data/test
absolute dir
Server start:java -cp *.jar org.h2.tools.Server
Settings
jdbc:h2:..;MODE=MySQL;DATABASE_TO_LOWER=TRUE
compatibility (or HSQLDB,…)
jdbc:h2:..;TRACE_LEVEL_FILE=3
log to *.trace.db
Thanks for the answer. Then I see that Hibernate and H2 also will work in H2 Server mode.
Nils
Sorry?
New question refused with error message:
“Sorry, new users can only mention 2 users in a post.”
Cannot understand the message and understand whats wrong?
Rgs Nils