Start building

Databases

JDBC · explicit transaction scope

Keep a prepared insert and query on one JDBC connection, then commit that exact transaction. Errors and unfinished scopes roll back instead of committing partially.

  • JSON → Database (JDBC/SQL)
  • Intermediate
  • 4 min

Last verified 2026-10-31 at f4ce7d0 — simulation fixtures

Try this template in Studio

Studio activation is a one-time payment of USD 20.

Flow

Drawn at build time from the node positions in the template's process definitions. Numbered markers are the walkthrough stages.

Main processJDBC · explicit transaction scope6 activities

Scroll sideways to see the whole flow.

Flow diagram of JDBC · explicit transaction scope6 activities and 5 transitions: Start, Begin on the CRM connection, Insert with the transaction handle, Read uncommitted work in the same scope, Commit the original connection, End.StartstartBegin on the CRMconnectionjdbc.begin1Insert with thetransaction handlejdbc.insert2Read uncommitted workin the same scopejdbc.query3Commit the originalconnectionjdbc.commit4Endend
List the 6 activities and 5 transitions

Activities

  1. Start start
  2. Begin on the CRM connection jdbc.begin
  3. Insert with the transaction handle jdbc.insert
  4. Read uncommitted work in the same scope jdbc.query
  5. Commit the original connection jdbc.commit
  6. End end

Transitions

  • Start → Begin on the CRM connection (on success)
  • Begin on the CRM connection → Insert with the transaction handle (on success)
  • Insert with the transaction handle → Read uncommitted work in the same scope (on success)
  • Read uncommitted work in the same scope → Commit the original connection (on success)
  • Commit the original connection → End (on success)

Walkthrough

  1. Begin on the CRM connectionOpen one run-owned JDBC connection. Pass its handle to related activities. Unfinished transactions are rolled back on cleanup.
  2. Insert with the transaction handleRegistered prepared write; participates in the selected run-owned transaction, or commits locally.
  3. Read uncommitted work in the same scopeNative Java JDBC, registered prepared statements, typed parameters, local commit/rollback. A vendor driver must be installed.
  4. Commit the original connectionFinish the original JDBC transaction on its original session. Never opens a new connection to finish a transaction.

What you will practise

  • Keep a prepared insert and query on one JDBC connection, then commit that exact transaction. Errors and unfinished scopes roll back instead of committing partially.
  • Shared connection IDs stay explicit. Simulation uses fixtures; live actions require operator approval.

Sample cases

1 case with 3 assertions, run with python -m server.integration examples --all in simulation.

End-to-end sample

Passed

Execute the actual flow with explicit external fixtures.

Expected result Every activity completes and the expected final result matches.

3/3 assertions

  • Flow completes
  • Final output
  • No unconfirmed receipts

This sample run only; not a production certification.

Prerequisites

Runtime
Cohuno runtime 1.27.0, the version recorded when these cases last passed.
Starter
Manual start; no listener.
Optional dependencies
  • Java 17+, the included JDBC bridge and your vendor JDBC driver (not bundled) needed only for live connections; simulation uses fixtures
Selected for this closure by the same rules as runtime packaging.
Simulation fixtures
  • crm_demo jdbc · jdbc.begin, jdbc.insert, jdbc.query, jdbc.commit
Every sample run replaces these connections with the fixtures defined in its case. A live run needs an operator to configure an authorized connection for each.
Verification details

Provenance

What was verified, and when. The content part changes whenever the pack, a process in its closure, the runtime version or a case result changes; the gallery check then fails until the gallery is regenerated and the changed templates are verified again.

Verified content

Pack SHA-256
a01219ef916b84644eb54f5927f040e66f43db3a04e2a23d66738ec88a087095
Closure SHA-256
7ddd7a1362fbc26d2b4915f4a3e83bb0d719d93fea06310177bd9edd01fdac2b
Runtime
1.27.0
Results
1/1 cases, 3/3 assertions, mode simulate, external calls: none.
Files in the closure
  • server/integration/example_packs/jdbc_scoped_transaction_lab.json
  • server/integration/templates/jdbc_scoped_transaction_lab.json

Verification event

Commit
f4ce7d08eedc90267b405ed1974344153a8b3a34
Verified at (UTC)
2026-10-31T21:19:21Z

How the Cohuno team reproduces this check

PYTHONPATH=. python -m server.integration examples --example jdbc_scoped_transaction_lab
PYTHONPATH=. python scripts/export_public_gallery.py --check