1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved. 2 3 package jodd.db.connection; 4 5 import java.sql.Connection; 6 7 /** 8 * A generic strategy for obtaining JDBC connections. 9 * <p> 10 * Implementors might also implement connection pooling. 11 * <p> 12 * Implementions should provide a public default constructor. 13 */ 14 public interface ConnectionProvider { 15 16 /** 17 * Initialize the connection provider. Properties are provided either 18 * with constructor either with bean setters. 19 */ 20 public void init(); 21 22 23 /** 24 * Get a connection. 25 */ 26 public Connection getConnection(); 27 28 /** 29 * Dispose of a used connection. 30 */ 31 public void closeConnection(Connection conn); 32 33 34 /** 35 * Closes a provider and realises all its resources. 36 */ 37 public void close(); 38 39 40 41 } 42