KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > JdbcConnectionSource


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdbc;
13
14 import java.sql.Connection JavaDoc;
15 import java.sql.SQLException JavaDoc;
16
17 /**
18  * Provides JDBC Connections.
19  */

20 public interface JdbcConnectionSource {
21
22     /**
23      * Get a Connection.
24      *
25      * @param highPriority If this is true then reserved high priority
26      * connections may be returned (e.g. for key generation)
27      * @param autoCommit Must the connection have autoCommit set?
28      */

29     public Connection JavaDoc getConnection(boolean highPriority,
30             boolean autoCommit) throws SQLException JavaDoc;
31
32     /**
33      * Return a Connection.
34      */

35     public void returnConnection(Connection JavaDoc con) throws SQLException JavaDoc;
36
37     /**
38      * Get the URL or "" if it is not known. This is for error messages and so
39      * on.
40      */

41     public String JavaDoc getURL();
42
43     /**
44      * Get the name of the JDBC driver (typically its class name) or
45      * "" if it is not known. This is for error messages and so
46      * on.
47      */

48     public String JavaDoc getDriverName();
49
50     /**
51      * Perform any initialization that requires connecting to the database or
52      * starting threads and so on. This should not be done in the constructor.
53      */

54     public void init();
55
56     /**
57      * Free any resources held. None of the methods should be called after
58      * this but the implementation is not required to throw exceptions if
59      * this happens.
60      */

61     public void destroy();
62
63     /**
64      * Close any idle connections if this source pools connections. This is
65      * a NOP if it does not.
66      */

67     public void closeIdleConnections();
68
69 }
70
71
Popular Tags