org.moremotion.util
Class JdbcConnection

java.lang.Object
  extended by org.moremotion.util.JdbcConnection

public class JdbcConnection
extends java.lang.Object

This class provides static methods for obtaining Data Base Connections.

If JNDI Datasource parameter is specified, either as parameter or in the Data Source Configuration, the methods first try to get the connection through JNDI, if they fail then they load the Jdbc Driver Class and gets the connection from the Driver Manager with the parameters defined in the RelDB Datasource.

Version:
$Id: JdbcConnection.java 207 2008-09-10 10:07:34Z erkan $

Constructor Summary
JdbcConnection()
           
 
Method Summary
static java.sql.Connection getConnection(MoreMotionRequest request, Config config)
          Returns a Jdbc connection.
static java.sql.Connection getConnection(MoreMotionRequest request, java.lang.String conName)
          Returns a Jdbc Connection.
static java.sql.Connection getConnection(java.lang.String conName)
          Returns a JdbcConnection connection.
static void releaseConnection(java.sql.Connection conn)
           
static void releaseRequestConnections(MoreMotionRequest request)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcConnection

public JdbcConnection()
Method Detail

getConnection

public static java.sql.Connection getConnection(java.lang.String conName)
                                         throws JdbcConnectionException
Returns a JdbcConnection connection.

Parameters:
conName - The name of the jdbcConnection as defined in configuration.
Returns:
The obtained connection.
Throws:
java.lang.Exception - if the cannot be obtained.
JdbcConnectionException

getConnection

public static java.sql.Connection getConnection(MoreMotionRequest request,
                                                java.lang.String conName)
                                         throws JdbcConnectionException
Returns a Jdbc Connection.

Parameters:
request - The MoreMotionRequest object
conName - The name of the jdbcConnection as defined in configuration.
Returns:
The obtained connection.
Throws:
java.lang.Exception - if no connection can be obtained.
JdbcConnectionException

getConnection

public static java.sql.Connection getConnection(MoreMotionRequest request,
                                                Config config)
                                         throws JdbcConnectionException
Returns a Jdbc connection. If a connection was obtained before with the same parameters during the same request it will be reused.

Parameters:
request - The MoreMotionRequest object
config - Config object
Returns:
The obtained connection.
Throws:
java.lang.Exception - if the cannot be obtained.
JdbcConnectionException

releaseConnection

public static void releaseConnection(java.sql.Connection conn)

releaseRequestConnections

public static void releaseRequestConnections(MoreMotionRequest request)
                                      throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2002-2008 MOR YAZILIM. All Rights Reserved.