org.apache.turbine.services.db
Class TurbineDB

java.lang.Object
  extended byorg.apache.turbine.services.db.TurbineDB

Deprecated. As of Turbine 2.2, use org.apache.torque.Torque

public abstract class TurbineDB
extends java.lang.Object

This class provides a common front end to all database - related services in Turbine. This class contains static methods that you can call to access the methods of system's configured service implementations.

This class is deprecated you should use org.apache.torque.Torque Connection dbConn = null; try { dbConn = Torque.getConnection(); // Do something with the connection here... } catch (Exception e) { // Either from obtaining the connection or from your application code. } finally { Torque.closeConnection(dbConn); }

Version:
$Id: TurbineDB.java 264148 2005-08-29 14:21:04Z henning $
Author:
Rafal Krzewski

Constructor Summary
TurbineDB()
          Deprecated.  
 
Method Summary
static java.sql.Connection getConnection()
          Deprecated. This method returns a DBConnection from the default pool.
static java.sql.Connection getConnection(java.lang.String name)
          Deprecated. This method returns a DBConnection from the pool with the specified name.
static org.apache.torque.map.DatabaseMap getDatabaseMap()
          Deprecated. Returns the default database map information.
static org.apache.torque.map.DatabaseMap getDatabaseMap(java.lang.String name)
          Deprecated. Returns the database map information.
static org.apache.torque.adapter.DB getDB()
          Deprecated. Returns the database adapter for the default connection pool.
static org.apache.torque.adapter.DB getDB(java.lang.String name)
          Deprecated. Returns database adapter for a specific connection pool.
static java.lang.String getDefaultDB()
          Deprecated. Returns the pool name for the default database.
static java.lang.String getDefaultMap()
          Deprecated. Returns the map name for the default database.
static void releaseConnection(java.sql.Connection dbconn)
          Deprecated. Release a connection back to the database pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbineDB

public TurbineDB()
Deprecated. 
Method Detail

getDefaultMap

public static java.lang.String getDefaultMap()
Deprecated. 
Returns the map name for the default database.

Returns:
the map name for the default database.

getDatabaseMap

public static org.apache.torque.map.DatabaseMap getDatabaseMap()
                                                        throws TurbineException
Deprecated. 
Returns the default database map information.

Returns:
A DatabaseMap.
Throws:
TurbineException - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.

getDatabaseMap

public static org.apache.torque.map.DatabaseMap getDatabaseMap(java.lang.String name)
                                                        throws TurbineException
Deprecated. 
Returns the database map information. Name relates to the name of the connection pool to associate with the map.

Parameters:
name - The name of the DatabaseMap to retrieve.
Returns:
The named DatabaseMap.
Throws:
TurbineException - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.

getDefaultDB

public static java.lang.String getDefaultDB()
Deprecated. 
Returns the pool name for the default database.

Returns:
the pool name for the default database.

getConnection

public static 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 - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.

getConnection

public static 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. The pool must be specified in the property file using the following syntax:
 database.[name].driver
 database.[name].url
 database.[name].username
 database.[name].password
 

Parameters:
name - The name of the pool to get a connection from.
Returns:
The requested connection.
Throws:
java.lang.Exception - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.

releaseConnection

public static void releaseConnection(java.sql.Connection dbconn)
                              throws java.lang.Exception
Deprecated. 
Release a connection back to the database pool.

Parameters:
dbconn - the connection to release
Throws:
java.lang.Exception - A generic exception.

getDB

public static 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 - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.

getDB

public static 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 - Any exceptions caught during processing will be rethrown wrapped into a TurbineException.


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