01: /*
02: * Copyright (C) 2003 <a href="mailto:jochen.hiller@bauer-partner.com">Jochen Hiller</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.mandarax.sql;
19:
20: import java.sql.Connection;
21: import java.sql.SQLException;
22:
23: import javax.sql.DataSource;
24:
25: /**
26: * A SQLConnectionManager defines the interface between the
27: * Mandarax SQL package and the connection handling with an SQL database.
28: *
29: * There will be a default implementation, which is able to handle
30: * standard SQL connections or handling via the J2EE compliant data sources.
31: *
32: * @see DefaultConnectionManager
33: * @see java.sql.Connection
34: * @see javax.sql.DataSource
35: *
36: * @todo add support for setting user/password
37: *
38: * @author <a href="mailto:jochen.hiller@bauer-partner.com">Jochen Hiller</a>
39: * @version 3.4 <7 March 05>
40: * @since 2.2
41: */
42: public interface SQLConnectionManager {
43:
44: /**
45: * Gets a data source from the connection manager.
46: *
47: * @return a data source
48: */
49: public DataSource getDataSource();
50:
51: /**
52: * Releases a connection, give it back to connection manager.
53: *
54: * It is in responsiblity of the implementation,
55: * whether the connection will be reused as part of a
56: * connection pool
57: */
58: public void releaseConnection(Connection con) throws SQLException;
59: }
|