KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > CommonDataSource


1 /*
2  * %W% %E%
3  *
4  * Copyright 2006 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 import java.io.PrintWriter JavaDoc;
12
13 /**
14  * Interface that defines the methods which are common between <code>DataSource</code>,
15  * <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>.
16  *<p>
17  */

18 public interface CommonDataSource {
19   
20   /**
21    * <p>Retrieves the log writer for this <code>DataSource</code>
22    * object.
23    *
24    * <p>The log writer is a character output stream to which all logging
25    * and tracing messages for this data source will be
26    * printed. This includes messages printed by the methods of this
27    * object, messages printed by methods of other objects manufactured
28    * by this object, and so on. Messages printed to a data source
29    * specific log writer are not printed to the log writer associated
30    * with the <code>java.sql.DriverManager</code> class. When a
31    * <code>DataSource</code> object is
32    * created, the log writer is initially null; in other words, the
33    * default is for logging to be disabled.
34    *
35    * @return the log writer for this data source or null if
36    * logging is disabled
37    * @exception java.sql.SQLException if a database access error occurs
38    * @see #setLogWriter
39    * @since 1.4
40    */

41   java.io.PrintWriter JavaDoc getLogWriter() throws SQLException JavaDoc;
42
43   /**
44    * <p>Sets the log writer for this <code>DataSource</code>
45    * object to the given <code>java.io.PrintWriter</code> object.
46    *
47    * <p>The log writer is a character output stream to which all logging
48    * and tracing messages for this data source will be
49    * printed. This includes messages printed by the methods of this
50    * object, messages printed by methods of other objects manufactured
51    * by this object, and so on. Messages printed to a data source-
52    * specific log writer are not printed to the log writer associated
53    * with the <code>java.sql.DriverManager</code> class. When a
54    * <code>DataSource</code> object is created the log writer is
55    * initially null; in other words, the default is for logging to be
56    * disabled.
57    *
58    * @param out the new log writer; to disable logging, set to null
59    * @exception SQLException if a database access error occurs
60    * @see #getLogWriter
61    * @since 1.4
62    */

63   void setLogWriter(java.io.PrintWriter JavaDoc out) throws SQLException JavaDoc;
64
65   /**
66    * <p>Sets the maximum time in seconds that this data source will wait
67    * while attempting to connect to a database. A value of zero
68    * specifies that the timeout is the default system timeout
69    * if there is one; otherwise, it specifies that there is no timeout.
70    * When a <code>DataSource</code> object is created, the login timeout is
71    * initially zero.
72    *
73    * @param seconds the data source login time limit
74    * @exception SQLException if a database access error occurs.
75    * @see #getLoginTimeout
76    * @since 1.4
77    */

78   void setLoginTimeout(int seconds) throws SQLException JavaDoc;
79
80   /**
81    * Gets the maximum time in seconds that this data source can wait
82    * while attempting to connect to a database. A value of zero
83    * means that the timeout is the default system timeout
84    * if there is one; otherwise, it means that there is no timeout.
85    * When a <code>DataSource</code> object is created, the login timeout is
86    * initially zero.
87    *
88    * @return the data source login time limit
89    * @exception SQLException if a database access error occurs.
90    * @see #setLoginTimeout
91    * @since 1.4
92    */

93   int getLoginTimeout() throws SQLException JavaDoc;
94   
95 }
96
Popular Tags