Persistence Issues w/ Auto-Commit = false

47 views
Skip to first unread message

Matt Hicks

unread,
Aug 28, 2024, 4:38:16 PM8/28/24
to H2 Database
I'm sharing a single Connection to a file instance of H2 with auto-commit set to false in embedded mode. Everything seems to work fine and I make sure to call connection.commit() after doing any work. However, frequently, I'm finding that when I stop the database and start it back up, data sometimes doesn't actually get persisted to the file and it starts back up saying that table is empty.

Is there anything I can do to guarantee everything is properly synchronized to the database file?

I've tried adding a shutdown hook to make sure commit is run and the connection is closed, but that doesn't seem to make much difference.

Noel Grandin

unread,
Aug 29, 2024, 2:23:51 AM8/29/24
to h2-da...@googlegroups.com

On 8/28/2024 10:38 PM, Matt Hicks wrote:
> I'm sharing a single Connection to a file instance of H2 with auto-commit set to false in embedded mode. Everything

Turn on tracing/logging and see if any problem is being reported.
Reply all
Reply to author
Forward
0 new messages