KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > ConnectionPoolDataSource


1 /*
2  * @(#)ConnectionPoolDataSource.java 1.10 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sql;
9
10 import java.sql.SQLException JavaDoc;
11
12
13 /**
14  * A factory for <code>PooledConnection</code>
15  * objects. An object that implements this interface will typically be
16  * registered with a naming service that is based on the
17  * Java<sup><font size=-2>TM</font></sup> Naming and Directory Interface
18  * (JNDI).
19  *
20  * @since 1.4
21  */

22
23 public interface ConnectionPoolDataSource {
24
25   /**
26    * Attempts to establish a physical database connection that can
27    * be used as a pooled connection.
28    *
29    * @return a <code>PooledConnection</code> object that is a physical
30    * connection to the database that this
31    * <code>ConnectionPoolDataSource</code> object represents
32    * @exception SQLException if a database access error occurs
33    */

34   PooledConnection JavaDoc getPooledConnection() throws SQLException JavaDoc;
35       
36   /**
37    * Attempts to establish a physical database connection that can
38    * be used as a pooled connection.
39    *
40    * @param user the database user on whose behalf the connection is being made
41    * @param password the user's password
42    * @return a <code>PooledConnection</code> object that is a physical
43    * connection to the database that this
44    * <code>ConnectionPoolDataSource</code> object represents
45    * @exception SQLException if a database access error occurs
46    */

47   PooledConnection JavaDoc getPooledConnection(String JavaDoc user, String JavaDoc password)
48     throws SQLException JavaDoc;
49       
50   /**
51    * Retrieves the log writer for this <code>ConnectionPoolDataSource</code>
52    * object.
53    * <p>The log writer is a character output stream to which all logging
54    * and tracing messages for this <code>ConnectionPoolDataSource</code> object
55    * are printed. This includes messages printed by the methods of this
56    * object, messages printed by methods of other objects manufactured
57    * by this object, and so on. Messages printed to a data source-
58    * specific log writer are not printed to the log writer associated
59    * with the <code>java.sql.DriverManager</code> class. When a data
60    * source object is created, the log writer is initially null; in other
61    * words, the default is for logging to be disabled.
62    *
63    * @return the log writer for this <code>ConnectionPoolDataSource</code>
64    * object or <code>null</code> if logging is disabled
65    * @exception SQLException if a database access error occurs
66    * @see #setLogWriter
67    */

68   java.io.PrintWriter JavaDoc getLogWriter() throws SQLException JavaDoc;
69
70   /**
71    * Sets the log writer for this <code>ConnectionPoolDataSource</code>
72    * object to the given <code>java.io.PrintWriter</code> object.
73    *
74    * <p>The log writer is a character output stream to which all logging
75    * and tracing messages for this <code>ConnectionPoolDataSource</code>
76    * object are printed. This includes messages printed by the methods of this
77    * object, messages printed by methods of other objects manufactured
78    * by this object, and so on. Messages printed to a data source-
79    * specific log writer are not printed to the log writer associated
80    * with the <code>java.sql.Drivermanager</code> class. When a data
81    * source object is created, the log writer is initially null; in other
82    * words, the default is for logging to be disabled.
83    *
84    * @param out the new log writer; <code>null</code> to disable logging
85    * @exception SQLException if a database access error occurs
86    * @see #getLogWriter
87    */

88   void setLogWriter(java.io.PrintWriter JavaDoc out) throws SQLException JavaDoc;
89
90   /**
91    * Sets the maximum time in seconds that this
92    * <code>ConnectionPoolDataSource</code> object will wait
93    * while attempting to connect to a database. A value of zero
94    * specifies that the timeout is the default system timeout
95    * if there is one; otherwise, it specifies that there is no timeout.
96    * When a <code>ConnectionPoolDataSource</code> object is created,
97    * the login timeout is initially zero.
98    *
99    * @param seconds the data source login time limit
100    * @exception SQLException if a database access error occurs.
101    * @see #getLoginTimeout
102    */

103   void setLoginTimeout(int seconds) throws SQLException JavaDoc;
104      
105   /**
106    * Retrieves the maximum time in seconds that this
107    * <code>ConnectionPoolDataSource</code> object will wait
108    * while attempting to connect to a database. A value of zero
109    * means that the timeout is the default system timeout
110    * if there is one; otherwise, it means that there is no timeout.
111    * When a <code>DataSource</code> object is created, its login timeout is
112    * initially zero.
113    *
114    * @return the data source login time limit
115    * @exception SQLException if a database access error occurs.
116    * @see #setLoginTimeout
117    */

118   int getLoginTimeout() throws SQLException JavaDoc;
119    
120  }
121
122
123
124
125
126
Popular Tags