org.apache.commons.dbcp

Class PoolingDataSource

Implemented Interfaces:
DataSource

public class PoolingDataSource
extends Object
implements DataSource

A simple DataSource implementation that obtains Connections from the specified ObjectPool.
Version:
$Revision: 1.13 $ $Date: 2004/02/28 12:18:17 $
Authors:
Rodney Waldhoff
Glenn L. Nielsen
James House
Dirk Verbeeck

Constructor Summary

PoolingDataSource()
PoolingDataSource(ObjectPool pool)

Method Summary

Connection
getConnection()
Return a Connection from my pool, according to the contract specified by ObjectPool.borrowObject.
Connection
getConnection(String uname, String passwd)
Throws UnsupportedOperationException
PrintWriter
getLogWriter()
Returns my log writer.
int
getLoginTimeout()
Throws UnsupportedOperationException.
boolean
isAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property.
void
setAccessToUnderlyingConnectionAllowed(boolean allow)
Sets the value of the accessToUnderlyingConnectionAllowed property.
void
setLogWriter(PrintWriter out)
Sets my log writer.
void
setLoginTimeout(int seconds)
Throws UnsupportedOperationException.
void
setPool(ObjectPool pool)

Constructor Details

PoolingDataSource

public PoolingDataSource()

PoolingDataSource

public PoolingDataSource(ObjectPool pool)

Method Details

getConnection

public Connection getConnection()
            throws SQLException
Return a Connection from my pool, according to the contract specified by ObjectPool.borrowObject.

getConnection

public Connection getConnection(String uname,
                                String passwd)
            throws SQLException
Throws UnsupportedOperationException

getLogWriter

public PrintWriter getLogWriter()
Returns my log writer.
Returns:
my log writer
See Also:
DataSource.getLogWriter

getLoginTimeout

public int getLoginTimeout()
Throws UnsupportedOperationException. Do this configuration within my ObjectPool.

isAccessToUnderlyingConnectionAllowed

public boolean isAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property.
Returns:
true if access to the underlying is allowed, false otherwise.

setAccessToUnderlyingConnectionAllowed

public void setAccessToUnderlyingConnectionAllowed(boolean allow)
Sets the value of the accessToUnderlyingConnectionAllowed property. It controls if the PoolGuard allows access to the underlying connection. (Default: false)
Parameters:
allow - Access to the underlying connection is granted when true.

setLogWriter

public void setLogWriter(PrintWriter out)
Sets my log writer.
See Also:
DataSource.setLogWriter

setLoginTimeout

public void setLoginTimeout(int seconds)
Throws UnsupportedOperationException. Do this configuration within my ObjectPool.

setPool

public void setPool(ObjectPool pool)
            throws IllegalStateException,
                   NullPointerException

Copyright © 2001-2003 Apache Software Foundation. Documenation generated October 24 2007.