Skip to content

ConnectionProvider

Zsolt Herpai edited this page Mar 12, 2015 · 4 revisions

A ConnectionProvider is responsible for providing JDBC Connections to FluentJdbc's query operations. The implementations generally follow the pattern below:

ConnectionProvider cp = query -> {
    Connection connection = ... // acquire a connection 
    query.receive(connection)   // make the connection available to FluentJdbc queries
    connection.close()          // release connection - may not be needed if connection is already managed
}  

FluentJdbc provides implementations for the most common scenarios out of the box, eg acquiring Connections from a DataSource. Check the sidebar menu under integrations for concrete implementations and examples.