|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This service provides database connection pooling to Turbine applications.
The service can manage a number of connection pools. Each pool is related
to a specific database, identified by it's driver class name, url, username
and password. The pools may be defined in TurbineResources.properties
file, or created at runtime using
#registerPool(String,String,String,String,String) method.
You can use getConnection(String) to acquire a
org.apache.turbine.util.db.pool.DBConnection object, which in
turn can be used to create java.sql.Statement objects.
When you are done using the DBConnection you must
return it to the pool using #releaseConnection(DBConnection) method.
This method call is often placed in finally clause of a try /
catch statement, to ensure that the connection is always returned
to the pool.
| Field Summary | |
static java.lang.String |
DEFAULT
Deprecated. the name of the default pool |
static java.lang.String |
DEFAULT_POOL
Deprecated. Name of default pool property |
static java.lang.String |
SERVICE_NAME
Deprecated. the name of the service |
| Method Summary | |
java.sql.Connection |
getConnection()
Deprecated. This method returns a DBConnection from the default pool. |
java.sql.Connection |
getConnection(java.lang.String name)
Deprecated. This method returns a DBConnection from the pool with the specified name. |
org.apache.torque.adapter.DB |
getDB()
Deprecated. Returns the database adapter for the default connection pool. |
org.apache.torque.adapter.DB |
getDB(java.lang.String name)
Deprecated. Returns database adapter for a specific connection pool. |
java.lang.String |
getDefaultDB()
Deprecated. Return default DB |
void |
releaseConnection(java.sql.Connection dbconn)
Deprecated. Release a connection back to the database pool. |
| Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
| Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, init, setInitableBroker, shutdown |
| Field Detail |
public static final java.lang.String SERVICE_NAME
public static final java.lang.String DEFAULT
public static final java.lang.String DEFAULT_POOL
| Method Detail |
public java.lang.String getDefaultDB()
public java.sql.Connection getConnection()
throws java.lang.Exception
java.lang.Exception - A generic exception.
public java.sql.Connection getConnection(java.lang.String name)
throws java.lang.Exception
name - The name of the pool to get a connection from.
java.lang.Exception - A generic exception.
public void releaseConnection(java.sql.Connection dbconn)
throws java.lang.Exception
java.lang.Exception - A generic exception.
public org.apache.torque.adapter.DB getDB()
throws java.lang.Exception
java.lang.Exception - A generic exception.
public org.apache.torque.adapter.DB getDB(java.lang.String name)
throws java.lang.Exception
name - A pool name.
java.lang.Exception - A generic exception.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||