Package com.oracle.database.selectai
Interface ConnectionCallback<T>
- Type Parameters:
T- result type returned by the JDBC work; may benull
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional unit of JDBC work executed synchronously with a connection
supplied by a
ConnectionProvider.
The callback does not own the supplied connection and must not close it,
retain it, or use it after this method returns. Connection acquisition and
operation lifecycle are controlled by the ConnectionProvider; a
retained connection is closed by its owning SelectAI,
DatabaseAdmin, or DbConnection object.
Depending on the provider, the connection may be borrowed for one operation or reused across multiple SDK operations.
-
Method Summary
Modifier and TypeMethodDescriptionexecute(Connection connection) Executes JDBC work with the connection supplied by the provider.
-
Method Details
-
execute
Executes JDBC work with the connection supplied by the provider.This method is invoked synchronously. Any JDBC resources created by the callback, such as statements or result sets, must be closed by the callback. The callback must not close the supplied connection.
- Parameters:
connection- non-null JDBC connection supplied for the current operation- Returns:
- result produced by the JDBC work, or
null - Throws:
SQLException- if a JDBC operation performed by the callback failsSelectAIException- when SDK-specific validation or nested work failsRuntimeException- when the callback fails with an unchecked exception
-