Application Integration & Schema Evolution
Connections, Sessions, and Protocols
A connection is a transport carrying a database protocol; a session is server-side identity and mutable context; a transaction is a bounded atomic history within that session. Correct clients establish, use, reset, and discard each layer deliberately.
- Transport, protocol, session, and transaction are distinct.
- Authentication is not authorization.
- Session state survives transaction boundaries.
- Protocol phases constrain legal recovery.
- Cancellation and connection loss have different meanings.
- Reset is a correctness operation.
| Layer | Representative state | End/reset signal |
|---|---|---|
| Transport | socket, TLS keys, liveness | close/discard |
| Protocol | message sequence, portals/cursors | responses drained; driver ready |
| Session | principal, role, settings, temporary/prepared objects | vendor/driver reset contract |
| Transaction | snapshot, locks, writes, failed flag | COMMIT or ROLLBACK acknowledged |
acquire(deadline)
verify connection is live and driver says IDLE
establish required role, schema, time zone, and statement timeout
execute work; consume or close every result
finally
if transaction active/failed: ROLLBACK and verify acknowledgement
restore session contract; otherwise discard
return only a known-clean connection