corda / net.corda.core.node / ServiceHub / jdbcSession


abstract fun jdbcSession(): Connection

Exposes a JDBC connection (session) object using the currently configured database. Applications can use this to execute arbitrary SQL queries (native, direct, prepared, callable) against its Node database tables (including custom contract tables defined by extending net.corda.core.schemas.QueryableState).

When used within a flow, this session automatically forms part of the enclosing flow transaction boundary, and thus queryable data will include everything committed as of the last checkpoint.


IllegalStateException - if called outside of a transaction.

A Connection