Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H2 database - embedded or server mode?

Tags:

database

h2

I am using Talend Open Studio for MDM which only supports a H2 database for the back end storage.

Should I use H2 DB in embedded or server mode.

What is the difference between it?.

like image 245
Guru Prasanna Avatar asked Oct 31 '25 19:10

Guru Prasanna


1 Answers

H2 in embedded mode will be faster (3x to 4x) but no other process can access the DB.

If your DB needs to be shared between servers or APIs, then the server mode is needed. Caution there: you need to start the H2 server first either in your main java app or in a separate JVM process.

There's is a automatic mixed mode, allowing the first connection to benefit from embedded speed, while the next connections will be using the server mode. Caution again: the H2 server needs to be started first.

How to start H2 server: http://h2database.com/html/tutorial.html?highlight=server&search=server#using_server

How to use automatic mixed mode: http://h2database.com/html/features.html?highlight=AUTO_SERVER&search=AUTO_SERVER#auto_mixed_mode

like image 128
Christian MICHON Avatar answered Nov 03 '25 11:11

Christian MICHON



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!