Home > Enterprise >  When transaction begins in jdbc connection pool?
When transaction begins in jdbc connection pool?

Time:01-06

Preconditions

  • Hikari connection pool
  • Oracle database
  • Default isolation level (read-commited)
  • setAutocomplete(false)
  • Our connection from the pool has already been used for some queries (it's not new)

The question

When does the next transaction start?

  1. right after the previous commit
  2. on any first request after the previous commit (even if it's a select statement)
  3. on the first change request after the previous commit (like, update, delete, insert)
  4. something else ?

CodePudding user response:

An Oracle database transaction starts with the SQL DML command (insert/update/delete) and ends with a commit or a rollback (which rolls back to the most recent commit). A select may read the result of a transaction - committed or uncommitted - but is not part of the transaction itself. There is nothing to do in Java to explicitly open or close a transaction; the transaction is defined only within a session and SQL commands in the database.

  • Related