Package org.apache.commons.dbcp
Class PoolingDataSource
java.lang.Object
org.apache.commons.dbcp.PoolingDataSource
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
- Direct Known Subclasses:
ManagedDataSource
- Version:
- $Revision: 895844 $ $Date: 2010-01-04 20:50:04 -0500 (Mon, 04 Jan 2010) $
- Author:
- Rodney Waldhoff, Glenn L. Nielsen, James House, Dirk Verbeeck
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn aConnection
from my pool, according to the contract specified byObjectPool.borrowObject()
.getConnection
(String uname, String passwd) int
ThrowsUnsupportedOperationException
.Returns my log writer.boolean
Returns the value of the accessToUnderlyingConnectionAllowed property.boolean
isWrapperFor
(Class<?> iface) void
setAccessToUnderlyingConnectionAllowed
(boolean allow) Sets the value of the accessToUnderlyingConnectionAllowed property.void
setLoginTimeout
(int seconds) ThrowsUnsupportedOperationException
.void
setLogWriter
(PrintWriter out) Sets my log writer.void
setPool
(org.apache.commons.pool.ObjectPool pool) <T> T
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
PoolingDataSource
public PoolingDataSource() -
PoolingDataSource
public PoolingDataSource(org.apache.commons.pool.ObjectPool pool)
-
-
Method Details
-
setPool
public void setPool(org.apache.commons.pool.ObjectPool pool) throws IllegalStateException, NullPointerException -
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.
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
getConnection
Return aConnection
from my pool, according to the contract specified byObjectPool.borrowObject()
.- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getConnection
- Specified by:
getConnection
in interfaceDataSource
- Throws:
UnsupportedOperationException
SQLException
-
getLogWriter
Returns my log writer.- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Returns:
- my log writer
- See Also:
-
getLoginTimeout
public int getLoginTimeout()ThrowsUnsupportedOperationException
.- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Throws:
UnsupportedOperationException
- As this implementation does not support this feature.
-
setLoginTimeout
public void setLoginTimeout(int seconds) ThrowsUnsupportedOperationException
.- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Throws:
UnsupportedOperationException
- As this implementation does not support this feature.
-
setLogWriter
Sets my log writer.- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- See Also:
-
getParentLogger
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-