org.apache.log.output.db

Class DefaultDataSource

Implemented Interfaces:
DataSource

public class DefaultDataSource
extends java.lang.Object
implements DataSource

A basic datasource that doesn't do any pooling but just wraps around default mechanisms.
Author:
Peter Donald

Constructor Summary

DefaultDataSource(String url, String username, String password)

Method Summary

Connection
getConnection()
Attempt to establish a database connection.
Connection
getConnection(String username, String password)
Attempt to establish a database connection.
PrintWriter
getLogWriter()
Get the log writer for this data source.
int
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
void
setLogWriter(PrintWriter logWriter)
void
setLoginTimeout(int loginTimeout)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.

Constructor Details

DefaultDataSource

public DefaultDataSource(String url,
                         String username,
                         String password)

Method Details

getConnection

public Connection getConnection()
            throws SQLException
Attempt to establish a database connection.
Returns:
the Connection

getConnection

public Connection getConnection(String username,
                                String password)
            throws SQLException
Attempt to establish a database connection.
Returns:
the Connection

getLogWriter

public PrintWriter getLogWriter()
            throws SQLException
Get the log writer for this data source.
Returns:
the LogWriter

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.
Returns:
the login time

setLogWriter

public void setLogWriter(PrintWriter logWriter)
            throws SQLException

setLoginTimeout

public void setLoginTimeout(int loginTimeout)
            throws SQLException
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
Parameters:
loginTimeout - the loging timeout in seconds