org.apache.commons.dbcp
Class PoolingDataSource

java.lang.Object
  extended byorg.apache.commons.dbcp.PoolingDataSource
All 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 $
Author:
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
 int getLoginTimeout()
          Throws UnsupportedOperationException.
 PrintWriter getLogWriter()
          Returns my log writer.
 boolean isAccessToUnderlyingConnectionAllowed()
          Returns the value of the accessToUnderlyingConnectionAllowed property.
 void setAccessToUnderlyingConnectionAllowed(boolean allow)
          Sets the value of the accessToUnderlyingConnectionAllowed property.
 void setLoginTimeout(int seconds)
          Throws UnsupportedOperationException.
 void setLogWriter(PrintWriter out)
          Sets my log writer.
 void setPool(ObjectPool pool)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolingDataSource

public PoolingDataSource()

PoolingDataSource

public PoolingDataSource(ObjectPool pool)
Method Detail

getConnection

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

Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

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

Specified by:
getConnection in interface DataSource
Throws:
UnsupportedOperationException
SQLException

getLoginTimeout

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

Specified by:
getLoginTimeout in interface DataSource
Throws:
UnsupportedOperationException

getLogWriter

public PrintWriter getLogWriter()
Returns my log writer.

Specified by:
getLogWriter in interface DataSource
Returns:
my log writer
See Also:
DataSource.getLogWriter()

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.

setLoginTimeout

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

Specified by:
setLoginTimeout in interface DataSource
Throws:
UnsupportedOperationException

setLogWriter

public void setLogWriter(PrintWriter out)
Sets my log writer.

Specified by:
setLogWriter in interface DataSource
See Also:
DataSource.setLogWriter(java.io.PrintWriter)

setPool

public void setPool(ObjectPool pool)
             throws IllegalStateException,
                    NullPointerException
Throws:
IllegalStateException
NullPointerException


Copyright © 2001-2003 Apache Software Foundation. Documenation generated October 18 2004.