01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc;
12:
13: import java.sql.Connection;
14: import java.sql.SQLException;
15:
16: /**
17: * Provides JDBC Connections.
18: */
19: public interface JdbcConnectionSource {
20:
21: /**
22: * Get a Connection.
23: *
24: * @param highPriority If this is true then reserved high priority
25: * connections may be returned (e.g. for key generation)
26: * @param autoCommit Must the connection have autoCommit set?
27: */
28: public Connection getConnection(boolean highPriority,
29: boolean autoCommit) throws SQLException;
30:
31: /**
32: * Return a Connection.
33: */
34: public void returnConnection(Connection con) throws SQLException;
35:
36: /**
37: * Get the URL or "" if it is not known. This is for error messages and so
38: * on.
39: */
40: public String getURL();
41:
42: /**
43: * Get the name of the JDBC driver (typically its class name) or
44: * "" if it is not known. This is for error messages and so
45: * on.
46: */
47: public String getDriverName();
48:
49: /**
50: * Perform any initialization that requires connecting to the database or
51: * starting threads and so on. This should not be done in the constructor.
52: */
53: public void init();
54:
55: /**
56: * Free any resources held. None of the methods should be called after
57: * this but the implementation is not required to throw exceptions if
58: * this happens.
59: */
60: public void destroy();
61:
62: /**
63: * Close any idle connections if this source pools connections. This is
64: * a NOP if it does not.
65: */
66: public void closeIdleConnections();
67:
68: }
|