net.sourceforge.idrs.jdbc
Class JDBCPool

java.lang.Object
  |
  +--net.sourceforge.idrs.utils.pool.ObjectPool
        |
        +--net.sourceforge.idrs.jdbc.JDBCPool
All Implemented Interfaces:
java.io.Serializable

public class JDBCPool
extends ObjectPool

JDBCPool is an ObjectPool of JDBC connection objects.

See Also:
Serialized Form

Field Summary
protected  JDBCInfo info
           
 
Fields inherited from class net.sourceforge.idrs.utils.pool.ObjectPool
count, daysOpen, debug, DEFAULT_DAYS_OPEN, DEFAULT_EXPIRATION, DEFAULT_MIN_POOLSIZE, DEFAULT_PATH, DEFAULT_SLEEPTIME, DEFAULT_TIMEOUT, DEFAULT_TRYS, limit, logPath, MAX_POOLSIZE, maxTrys, minn, out, pool, sleepTime
 
Constructor Summary
JDBCPool(java.lang.String poolname, java.lang.String drivername, java.lang.String url, java.lang.String username, java.lang.String password, int min, int limit, long daysOpen, long sleep, java.lang.String path, int trys)
          Create a JDBCPool with full control of all parameters.
 
Method Summary
protected  PooledObject create()
          Creates a new JDBC connection
 boolean equals(java.lang.Object obj)
           
protected  void expire(PooledObject o)
          Closes a database connection.
 void freeConnection(java.sql.Connection conn)
          Returns a connection to the pool.
 void freeConnection(java.lang.String connName)
           
 java.sql.Connection getConnection()
          Retrieves a connection.
 JDBCInfo getInfo()
           
 int hashCode()
           
protected  void logHeader()
           
protected  void reset(int index)
           
 void setInfo(JDBCInfo i)
           
protected  boolean validate(PooledObject o)
          Checks to see if the current connection is valid.
 
Methods inherited from class net.sourceforge.idrs.utils.pool.ObjectPool
checkIn, checkIn, checkOut, getConnID, isDebugging, setDebugging, shouldReset
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

info

protected JDBCInfo info
Constructor Detail

JDBCPool

public JDBCPool(java.lang.String poolname,
                java.lang.String drivername,
                java.lang.String url,
                java.lang.String username,
                java.lang.String password,
                int min,
                int limit,
                long daysOpen,
                long sleep,
                java.lang.String path,
                int trys)
         throws java.lang.Exception
Create a JDBCPool with full control of all parameters.
Parameters:
drivername - the name of the sql driver
url - the url for the db connection
username - the user of the db connections
password - the paswer for the db user
timeout - the timout for a given connection
sleep - the amount of time between sk4m cycles.
limit - is the maximum number of open connections allowed.
Method Detail

logHeader

protected void logHeader()
                  throws java.lang.Exception
Overrides:
logHeader in class ObjectPool

create

protected PooledObject create()
                       throws java.sql.SQLException
Creates a new JDBC connection
Overrides:
create in class ObjectPool

validate

protected boolean validate(PooledObject o)
Checks to see if the current connection is valid.
Overrides:
validate in class ObjectPool

expire

protected void expire(PooledObject o)
Closes a database connection.
Overrides:
expire in class ObjectPool

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Retrieves a connection. Renamed from requestConnection

freeConnection

public void freeConnection(java.sql.Connection conn)
                    throws java.lang.Exception
Returns a connection to the pool. Renamed from returnConnection

freeConnection

public void freeConnection(java.lang.String connName)
                    throws java.lang.Exception

getInfo

public JDBCInfo getInfo()

setInfo

public void setInfo(JDBCInfo i)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

reset

protected void reset(int index)
Overrides:
reset in class ObjectPool