title: How do I share H2 in-memory database across multiple Spring boot applications?
body: <p>This is a different scenario than the other answered questions. I have one Spring boot application (app #1) that uses embedded H2 in-memory database and exposes it as a server. My second Spring boot application (app #2) connects to the H2 server from app #1 and that works correctly. I can store and retrieve data from H2. Now here is the problem. I have a third Spring boot (app #3) and it connects to the H2 server from app #1. The connection works but it (Issue #1) clears all the data that had been stored previously by app #2. After this, now both app #2 and #3 can store and retrieve its data and also each other's data. Now I terminate either app #2 or app #3 and (Issue #2) the remaining app cannot continue using the H2 in-memory database. Are issues #1 and #2 normal behavior? If not, how can I fix them? I want my H2 data to stay as long as app #1 (the H2 server) is running, even if other apps have been disconnected and I don't want my data cleared when new apps connect to the H2 server.</p>