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

Field Summary

private PrintWriter
m_logWriter
private int
m_loginTimeout
private String
m_password
private String
m_url
private String
m_username

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.

Field Details

m_logWriter

private PrintWriter m_logWriter

m_loginTimeout

private int m_loginTimeout

m_password

private final String m_password

m_url

private final String m_url

m_username

private final String m_username

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