站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档

XADataSource (JBoss J2EE API) - JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档


javax.sql
Interface XADataSource


public interface XADataSource

A factory for XAConnection objects. An object that implements the XADataSource interface is typically registered with a JNDI service provider.


Method Summary
 int getLoginTimeout()
          Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
 PrintWriter getLogWriter()
          Get the log writer for this data source.
 XAConnection getXAConnection()
          Attempt to establish a database connection.
 XAConnection getXAConnection(String user, String password)
          Attempt to establish a database connection.
 void setLoginTimeout(int sec)
          Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
 void setLogWriter(PrintWriter printWriter)
          Set the log writer for this data source.
 

Method Detail

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException

Get the log writer for this data source.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.

Returns:
the log writer for this data source, null if disabled
Throws:
SQLException - - if a database-access error occurs.

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise it means that there is no timeout. When a data source object is created the login timeout is initially zero.

Returns:
the data source login time limit
Throws:
SQLException - - if a database-access error occurs.

getXAConnection

public XAConnection getXAConnection()
                             throws SQLException
Attempt to establish a database connection.

Returns:
a Connection to the database
Throws:
SQLException - - if a database-access error occurs.

getXAConnection

public XAConnection getXAConnection(String user,
                                    String password)
                             throws SQLException
Attempt to establish a database connection.

Parameters:
user - - the database user on whose behalf the Connection is being made
password - - the user's password
Returns:
a Connection to the database
Throws:
SQLException - - if a database-access error occurs.

setLogWriter

public void setLogWriter(PrintWriter printWriter)
                  throws SQLException

Set the log writer for this data source.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.

Parameters:
printWriter - - the new log writer; to disable, set to null
Throws:
SQLException - - if a database-access error occurs.

setLoginTimeout

public void setLoginTimeout(int sec)
                     throws SQLException
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout. When a data source object is created the login timeout is initially zero.

Parameters:
sec - - the data source login time limit
Throws:
SQLException - - if a database-access error occurs.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.