| javax.sql.DataSource
DataSource | public interface DataSource (Code) | | A DataSource object is a factory for Connection objects. An object that implements the DataSource interface
will typically be registered with a JNDI service provider. A JDBC driver that is accessed via the DataSource
API does not automatically register itself with the DriverManager.
|
Method Summary | |
public Connection | getConnection() Attempt to establish a database connection. | public Connection | getConnection(String user, String password) Attempt to establish a database connection. | public PrintWriter | getLogWriter() 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. | public int | getLoginTimeout() 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. | public void | setLogWriter(PrintWriter printWriter) 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. | public void | setLoginTimeout(int seconds) 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. |
getConnection | public Connection getConnection() throws SQLException(Code) | | Attempt to establish a database connection.
a Connection to the database exception: SQLException - - if a database-access error occurs. |
getConnection | public Connection getConnection(String user, String password) throws SQLException(Code) | | Attempt to establish a database connection.
Parameters: user - - the database user on whose behalf the Connection is being made Parameters: password - - the user's password a Connection to the database exception: SQLException - - if a database-access error occurs. |
getLogWriter | public PrintWriter getLogWriter() throws SQLException(Code) | | 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 DataSource object is created the log writer is initially null, in other words, logging is disabled.
the log writer for this data source, null if disabled exception: SQLException - - if a database-access error occurs. |
getLoginTimeout | public int getLoginTimeout() throws SQLException(Code) | | 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 DataSource object is created the login timeout is initially zero.
the data source login time limit exception: SQLException - - if a database access error occurs. |
setLogWriter | public void setLogWriter(PrintWriter printWriter) throws SQLException(Code) | | 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 DataSource 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 exception: SQLException - - if a database-access error occurs. |
setLoginTimeout | public void setLoginTimeout(int seconds) throws SQLException(Code) | | 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 DataSource object is created the login timeout is initially zero.
Parameters: seconds - - the data source login time limit exception: SQLException - - if a database access error occurs. |
|
|