KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > XADataSource


1 /*
2  * @(#)XADataSource.java 1.9 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.*;
11
12 /**
13  * A factory for <code>XAConnection</code> objects that is used internally.
14  * An object that implements the <code>XADataSource</code> interface is
15  * typically registered with a naming service that uses the
16  * Java Naming and Directory Interface<sup><font size=-3>TM</font></sup>
17  * (JNDI).
18  *
19  * @since 1.4
20  */

21
22 public interface XADataSource {
23
24   /**
25    * Attempts to establish a physical database connection that can be
26    * used in a distributed transaction.
27    *
28    * @return an <code>XAConnection</code> object, which represents a
29    * physical connection to a data source, that can be used in
30    * a distributed transaction
31    * @exception SQLException if a database access error occurs
32    */

33   XAConnection JavaDoc getXAConnection() throws SQLException;
34       
35   /**
36    * Attempts to establish a physical database connection, using the given
37    * user name and password. The connection that is returned is one that
38    * can be used in a distributed transaction.
39    *
40    * @param user the database user on whose behalf the connection is being made
41    * @param password the user's password
42    * @return an <code>XAConnection</code> object, which represents a
43    * physical connection to a data source, that can be used in
44    * a distributed transaction
45    * @exception SQLException if a database access error occurs
46    */

47   XAConnection JavaDoc getXAConnection(String JavaDoc user, String JavaDoc password)
48     throws SQLException;
49       
50   /**
51    * <p>Retrieves the log writer for this <code>XADataSource</code> object.
52    *
53    * @return the log writer for this data source; <code>null</code> if no log
54    * writer has been set, which means that logging is disabled
55    * @exception SQLException if a database access error occurs
56    * @see #setLogWriter
57    */

58   java.io.PrintWriter JavaDoc getLogWriter() throws SQLException;
59
60   /**
61    * Sets the log writer for this <code>XADataSource</code> object
62    * to the given <code>java.io.PrintWriter</code> object.
63    * <P>
64    * The log writer is a character output stream to which all logging
65    * and tracing messages for this <code>XADataSource</code> object will be
66    * printed. This includes messages printed by the methods of this
67    * object, messages printed by methods of other objects manufactured
68    * by this object, and so on. Messages printed to a log writer that is
69    * specific to a data source are not printed to the log writer associated
70    * with the <code>java.sql.DriverManager</code> class. When a data source
71    * object is created, the log writer is initially <code>null</code>.
72    *
73    * @param out the new log writer; to disable logging, set to <code>null</code>
74    * @exception SQLException if a database access error occurs
75    * @see #getLogWriter
76    */

77   void setLogWriter(java.io.PrintWriter JavaDoc out) throws SQLException;
78
79   /**
80    * <p>Sets the maximum time in seconds that this data source will wait
81    * while attempting to connect to a data source. A value of zero
82    * specifies that the timeout is the default system timeout
83    * if there is one; otherwise, it specifies that there is no timeout.
84    * When a data source object is created, the login timeout is
85    * initially zero.
86    *
87    * @param seconds the data source login time limit
88    * @exception SQLException if a database access error occurs
89    * @see #getLoginTimeout
90    */

91   void setLoginTimeout(int seconds) throws SQLException;
92      
93   /**
94    * Retrieves the maximum time in seconds that this data source can wait
95    * while attempting to connect to a data source. A value of zero
96    * means that the timeout is the default system timeout
97    * if there is one; otherwise, it means that there is no timeout.
98    * When a data source object is created, the login timeout is
99    * initially zero.
100    *
101    * @return the number of seconds that is the login time limit for this
102    * <code>XADataSource</code> object or zero if there is no
103    * no timeout limit or the timeout limit is the default system
104    * timeout limit if there is one
105    * @exception SQLException if a database access error occurs
106    * @see #setLoginTimeout
107    */

108   int getLoginTimeout() throws SQLException;
109    
110  }
111
112
113
114
115
116
Popular Tags