Sample Header Ad - 728x90

Keep H2 in-memory database between connections

6 votes
1 answer
11756 views
I create and use a H2 database in-memory (no writing to storage) for demos and quick tests using this code in Java: Connection conn = DriverManager.getConnection( "jdbc:h2:mem:example_db" ) ; This works the first time, but then the database seems to disappear, unavailable for further work. How can I make use of the same in-memory database over time?
Asked by Basil Bourque (11188 rep)
Dec 6, 2018, 08:58 PM
Last activity: Oct 20, 2019, 11:00 PM