1

I have two independent Java apps which I would like to communicate with each other through an in-memory H2-DB. In theory very straight forward, but I cannot get the connection to work.

What I am trying to do: I create an in-memory DB executing jdbc:h2:mem:test. With the client(s), I try connecting to it. I tried jdbc:h2:tcp://localhost/~/test and similar connection strings, but all without success.

Is it possible to connect to an in-memory DB? What should the connection strings look like to make this work? Thanks a bunch.

2 Answers 2

3

After a ton of reading and trial-and-error with H2 options (http://h2database.com/html/features.html and http://h2database.com/html/advanced.html), I found that it is possible to access an in-memory database from multiple processes on the same machine (or remotely) using TCP/IP or SSL/TLS. The connection string for an in-memory database test is jdbc:h2:tcp://localhost/mem:test.

Sign up to request clarification or add additional context in comments.

Comments

0
+50

H2 database can be shared but not in memory, Your may please refer to official documentation:

http://h2database.com/html/features.html#auto_mixed_mode

First application with open it in embedded mode and other application will use server mode.

1 Comment

Thank you for taking the time to answer. I actually found that it is possible to access an in-memory database from multiple processes on the same machine (cf. my answer). I am awarding the 50 point bounty to you for taking the time. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.