1 package com.github.davidmoten.rx.jdbc;
2
3 import java.sql.Connection;
4
5 /**
6 * Provides JDBC Connections as required. It is advisable generally to use a
7 * Connection pool.
8 *
9 **/
10 public interface ConnectionProvider {
11
12 /**
13 * Returns a new {@link Connection} (perhaps from a Connection pool).
14 *
15 * @return a new Connection to a database
16 */
17 Connection get();
18
19 /**
20 * Closes the connection provider and releases its resources. For example, a
21 * connection pool may need formal closure to release its connections
22 * because connection.close() is actually just releasing a connection back
23 * to the pool for reuse. This method should be idempotent.
24 */
25 void close();
26
27 }