org.apache.turbine.services.db
Interface PoolBrokerService

All Superinterfaces:
Initable, Service
All Known Implementing Classes:
TurbinePoolBrokerService

Deprecated. use org.apache.torque.Torque

public interface PoolBrokerService
extends Service

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.

Version:
$Id: PoolBrokerService.java,v 1.4 2002/07/12 20:46:55 mpoeschl Exp $
Author:
Rafal Krzewski

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

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
Deprecated. 
the name of the service

DEFAULT

public static final java.lang.String DEFAULT
Deprecated. 
the name of the default pool

DEFAULT_POOL

public static final java.lang.String DEFAULT_POOL
Deprecated. 
Name of default pool property
Method Detail

getDefaultDB

public java.lang.String getDefaultDB()
Deprecated. 
Return default DB

getConnection

public java.sql.Connection getConnection()
                                  throws java.lang.Exception
Deprecated. 
This method returns a DBConnection from the default pool.
Returns:
The requested connection.
Throws:
java.lang.Exception - A generic exception.

getConnection

public java.sql.Connection getConnection(java.lang.String name)
                                  throws java.lang.Exception
Deprecated. 
This method returns a DBConnection from the pool with the specified name.
Parameters:
name - The name of the pool to get a connection from.
Returns:
The requested connection.
Throws:
java.lang.Exception - A generic exception.

releaseConnection

public void releaseConnection(java.sql.Connection dbconn)
                       throws java.lang.Exception
Deprecated. 
Release a connection back to the database pool.
Throws:
java.lang.Exception - A generic exception.

getDB

public org.apache.torque.adapter.DB getDB()
                                   throws java.lang.Exception
Deprecated. 
Returns the database adapter for the default connection pool.
Returns:
The database adapter.
Throws:
java.lang.Exception - A generic exception.

getDB

public org.apache.torque.adapter.DB getDB(java.lang.String name)
                                   throws java.lang.Exception
Deprecated. 
Returns database adapter for a specific connection pool.
Parameters:
name - A pool name.
Returns:
The corresponding database adapter.
Throws:
java.lang.Exception - A generic exception.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.