corda / net.corda.testing.node / MockServices / jdbcSession

jdbcSession

open 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.

We want to make sure users have a restricted access to administrative functions, this function will return a RestrictedConnection instance. The following methods are blocked:

Exceptions

IllegalStateException - if called outside of a transaction.

Return
A Connection