org.exolab.jms.persistence
Interface DBConnectionManager

All Known Implementing Classes:
AbstractConnectionManager

public interface DBConnectionManager

This interface is used to support different connection pooling packages such as Tyrex, DBCP, Minerva, PoolMan and Proxool. The client must first set the properties of the connection manager before making a call to {link #getConnection}

Version:
$Revision: 1.1 $ $Date: 2004/11/26 01:50:44 $
Author:
Jim Alateras

Method Summary
 java.sql.Connection getConnection()
          Retrieve a connection to the underlying database for the pool of connections.
 void init()
          Initialise the connection manager.
 void setDriver(java.lang.String driver)
          Sets the JDBC driver class name
 void setEvictionInterval(long interval)
          Sets the interval between checking idle connections for eviction.
 void setMaxActive(int active)
          Sets the maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
 void setMaxIdle(int idle)
          Sets the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
 void setMinIdleTime(long time)
          Sets the minimum time that a connection may remain idle before it may be evicted, or zero for no eviction.
 void setPassword(java.lang.String password)
          Sets the user's password that is used to access the database
 void setTestBeforeUse(boolean test)
          Determines if connections should be tested before use.
 void setTestQuery(java.lang.String query)
          Specifies an SQL query to validate connections.
 void setURL(java.lang.String url)
          Sets the URL to the database
 void setUser(java.lang.String name)
          Sets the user name that is used to obtain the connection
 

Method Detail

setUser

public void setUser(java.lang.String name)
Sets the user name that is used to obtain the connection
Parameters:
name - the user name

setPassword

public void setPassword(java.lang.String password)
Sets the user's password that is used to access the database
Parameters:
password - the user's password

setDriver

public void setDriver(java.lang.String driver)
Sets the JDBC driver class name
Parameters:
driver - the JDBC driver class name

setURL

public void setURL(java.lang.String url)
Sets the URL to the database
Parameters:
url - the JDBC URL

setMaxActive

public void setMaxActive(int active)
Sets the maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
Parameters:
active - the maximum number of active connections

setMaxIdle

public void setMaxIdle(int idle)
Sets the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
Parameters:
idle - the maximum number of idle connections

setMinIdleTime

public void setMinIdleTime(long time)
Sets the minimum time that a connection may remain idle before it may be evicted, or zero for no eviction.
Parameters:
time - the idle time, in seconds

setEvictionInterval

public void setEvictionInterval(long interval)
Sets the interval between checking idle connections for eviction. Idle connections are removed after setMinIdleTime(long) seconds, or if {@ link #testQuery} is specified, and the query fails.
Parameters:
interval - the eviction interval, in seconds

setTestQuery

public void setTestQuery(java.lang.String query)
Specifies an SQL query to validate connections. This query should return at least one row, and be fast to execute.
Parameters:
query - the test query

setTestBeforeUse

public void setTestBeforeUse(boolean test)
Determines if connections should be tested before use. If true, each connection is tested before being returned. If a connection fails, it is discarded, and another connection allocated. This ensures a higher reliability, at the cost of performance.
Parameters:
test - if true, each connection is tested use.

init

public void init()
          throws PersistenceException
Initialise the connection manager. This must be called before a call to getConnection() is made and after all the properties have been set.
Throws:
PersistenceException - - if there is a problem with the init

getConnection

public java.sql.Connection getConnection()
                                  throws PersistenceException
Retrieve a connection to the underlying database for the pool of connections. This can only be called after the properties have been set and the manager has been initialized
Throws:
PersistenceException - - if there is a problem with the init


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.