I am using an H2 database with JDBC to create a connection with setAutoCommit(false).

I am currently programatically checking whether or not there is an uncommitted transaction, but I was wondering if there was a way to directly query H2 for information about this state.

I have found some information for other databases on this topic, but nothing so far on H2.

  • 1
    I asked the same thing on StackOverflow.com. Surprisingly, there seems to be no way to do this in standard JDBC. Someone gave me a tip about a Postgres-specific way to query the status (IDLE, OPEN, FAILED) of any existing transaction. I posted example code there that may be of interest, but you’ll need to find an H2-specific class to substitute for my Postgres-specific class. Commented Sep 6, 2015 at 21:54


Your Answer

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

Browse other questions tagged or ask your own question.