Package org.jdbi.v3.core
Interface ConnectionFactory
- All Known Implementing Classes:
SpringConnectionFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies
Connection instances to a created Handle and allows
custom close handling.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcloseConnection(Connection conn) Closes a connection.default CleanablegetCleanableFor(Connection conn) Returns aCleanablethat will close the connection and release all necessary resources.Opens a connection.
-
Method Details
-
openConnection
Opens a connection.- Returns:
- A
Connectionobject. - Throws:
SQLException- if anything goes wrong
-
closeConnection
Closes a connection.- Parameters:
conn- AConnectionobject.- Throws:
SQLException- if anything goes wrong
-
getCleanableFor
Returns aCleanablethat will close the connection and release all necessary resources. LikeConnection.close(), the Cleanable should no-op if called more than once.- Parameters:
conn- AConnectionobject.- Returns:
- A
Cleanableinstance. Calling theCleanable.close()method will close the connection and release all resources.
-