org.apache.commons.dbcp
Class PoolingDataSource

java.lang.Object
  |
  +--org.apache.commons.dbcp.PoolingDataSource
All Implemented Interfaces:
javax.sql.DataSource

public class PoolingDataSource
extends java.lang.Object
implements javax.sql.DataSource

A simple DataSource implementation that obtains Connections from the specified ObjectPool.

Version:
$Id: PoolingDataSource.java,v 1.3 2002/05/16 21:25:38 glenn Exp $
Author:
Rodney Waldhoff
, Glenn L. Nielsen , James House (james@interobjective.com)

Field Summary
protected  java.io.PrintWriter _logWriter
          My log writer.
protected  org.apache.commons.pool.ObjectPool _pool
           
 
Constructor Summary
PoolingDataSource()
           
PoolingDataSource(org.apache.commons.pool.ObjectPool pool)
           
 
Method Summary
 java.sql.Connection getConnection()
          Return a Connection from my pool, according to the contract specified by ObjectPool.borrowObject().
 java.sql.Connection getConnection(java.lang.String uname, java.lang.String passwd)
          Throws UnsupportedOperationException
 int getLoginTimeout()
          Throws UnsupportedOperationException.
 java.io.PrintWriter getLogWriter()
          Returns my log writer.
 void setLoginTimeout(int seconds)
          Throws UnsupportedOperationException.
 void setLogWriter(java.io.PrintWriter out)
          Sets my log writer.
 void setPool(org.apache.commons.pool.ObjectPool pool)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logWriter

protected java.io.PrintWriter _logWriter
My log writer.


_pool

protected org.apache.commons.pool.ObjectPool _pool
Constructor Detail

PoolingDataSource

public PoolingDataSource()

PoolingDataSource

public PoolingDataSource(org.apache.commons.pool.ObjectPool pool)
Method Detail

getConnection

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

Specified by:
getConnection in interface javax.sql.DataSource
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(java.lang.String uname,
                                         java.lang.String passwd)
                                  throws java.sql.SQLException
Throws UnsupportedOperationException

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.lang.UnsupportedOperationException
java.sql.SQLException

getLoginTimeout

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

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.lang.UnsupportedOperationException

getLogWriter

public java.io.PrintWriter getLogWriter()
Returns my log writer.

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

setLoginTimeout

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

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Throws:
java.lang.UnsupportedOperationException

setLogWriter

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

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

setPool

public void setPool(org.apache.commons.pool.ObjectPool pool)
             throws java.lang.IllegalStateException,
                    java.lang.NullPointerException
java.lang.IllegalStateException
java.lang.NullPointerException


Copyright © 2001 Apache Software Foundation. Documenation generated August 12 2002.