org.opensubsystems.core.persist.db
Class DatabaseConnectionFactoryImpl

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseConnectionFactoryImpl
All Implemented Interfaces:
DatabaseConnectionFactory
Direct Known Subclasses:
PooledDatabaseConnectionFactoryImpl

public abstract class DatabaseConnectionFactoryImpl
extends java.lang.Object
implements DatabaseConnectionFactory

Base class for implementation of factories for retrieving and returning of database connections. Most likely one project will use only one implementation of connection factory therefore this class contains factory methods to instantiate and return default instance of connection factory even though it still allows multiple instances of connection factory to exist since all attributes are non-static.

Version:
$Id: DatabaseConnectionFactoryImpl.java,v 1.21 2007/01/07 06:14:18 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.14 2006/04/05 04:58:41 bastafidli

Field Summary
static java.lang.String ADMIN_DATASOURCE_NAME
          Name that will be used for datasource which should have administration priviledges to setup the database.
static java.lang.String DATABASE_ADMIN_PASSWORD
          Name of the property containing user password to connect to the database, as administrator e.g.
static java.lang.String DATABASE_ADMIN_USER
          Name of the property containing user name to connect to the database, as an administrator e.g.
static java.lang.String DATABASE_DRIVER
          Name of the property containing driver to use to connect to the database, e.g.
static java.lang.String DATABASE_PASSWORD
          Name of the property containing user password to connect to the database, e.g.
static java.lang.String DATABASE_URL
          Name of the property containing URL to connect to the database, e.g.
static java.lang.String DATABASE_USE_ADMIN_DATAROURCE
          Name of the property specifying if to use an separate datasource to obtain administration connection instead of just using the default data source with separate credentials.
static boolean DATABASE_USE_ADMIN_DATAROURCE_DEFAULT
          Default value for flag specifying if to use separate datasource for admin connections.
static java.lang.String DATABASE_USER
          Name of the property containing user name to connect to the database, e.g.
protected  boolean m_bUseAdminDataSource
          If true then use an separate datasource to obtain administration connection instead of just using the default data source with separate credentials.
protected  int m_iRequestedConnectionCount
          How many connections were requested and not returned.
protected  java.lang.String m_strDatabaseAdminPassword
          Password for user with with administration priviledges to connect to the database, e.g.
protected  java.lang.String m_strDatabaseAdminUser
          User name with administration priviledges to connect to the database, e.g.
protected  java.lang.String m_strDatabaseDriver
          Driver to use to connect to the database, e.g.
protected  java.lang.String m_strDatabasePassword
          Password to connect to the database, e.g.
protected  java.lang.String m_strDatabaseURL
          URL to connect to the database, e.g.
protected  java.lang.String m_strDatabaseUser
          User name to connect to the database, e.g.
protected  java.lang.String m_strRealDatabaseDriver
          Real driver which is used to connect to database.
protected  DatabaseTransactionFactoryImpl m_transactionFactory
          This is concrete implementation of database transaction factory, which will be used to manage transactions across connections allocated by this database connection factory.
static java.lang.String SPY_CONFIG_FILE_NAME
          Name of the configuration file for the spy driver.
static java.lang.String SPY_DRIVER_IDENTIFICATION
          This string is used to identify JDBC spy driver.
static java.lang.String SPY_REALDRIVER
          Name of the property which contains identification of real driver user by the spy driver.
 
Constructor Summary
DatabaseConnectionFactoryImpl()
          Default constructor.
DatabaseConnectionFactoryImpl(DatabaseTransactionFactoryImpl transactionFactory)
          Default constructor.
DatabaseConnectionFactoryImpl(java.lang.String strDriver, java.lang.String strURL, java.lang.String strUser, java.lang.String strPassword, DatabaseTransactionFactoryImpl transactionFactory)
          Constructor with explicitely specified JDBC driver.
 
Method Summary
 java.lang.String getDatabaseAdminPassword()
          Returns the database administration password.
 java.lang.String getDatabaseAdminUser()
          Returns the database administration user.
 java.lang.String getDatabaseDriver()
          Returns the database driver identification.
 java.lang.String getDatabasePassword()
          Returns the database password.
 java.lang.String getDatabaseURL()
          Returns the database URL.
 java.lang.String getDatabaseUser()
          Returns the database user.
static DatabaseConnectionFactory getInstance()
          Get the default database connection factory.
 java.lang.String getRealDatabaseDriver()
          Get real driver name which is used to connect to database.
 int getTotalRequestedConnectionCount()
          Get number for connections which are currently requested and were not returned.
 boolean getUseAdminDataSource()
          Get the flag specifying if to use separate datasource instead just different creadentials to obtain administrator connection.
protected  void initializeConnection(java.sql.Connection cntDBConnection, boolean bAutoCommit)
          Initialize connection to the default state so it can be used to work with the database.
protected  void initializeDriver(java.lang.String strDatabaseDriver)
          Initialize specified database driver.
 void loadDefaultDatabaseProperties()
          Load default database properties such as what driver, user name or password to use from configuration file.
 java.sql.Connection requestConnection(boolean bAutoCommit)
          Get connection to a database as configured by the default data source.
 java.sql.Connection requestConnection(boolean bAutoCommit, java.lang.String strDataSourceName)
          Get connection to a database as configured by the default data source.
 java.sql.Connection requestConnection(boolean bAutoCommit, java.lang.String strUser, java.lang.String strPassword)
          Get connection to a database as configured by the default data source but using explicit user credential.
 java.sql.Connection requestConnection(boolean bAutoCommit, java.lang.String strDataSourceName, java.lang.String strUser, java.lang.String strPassword)
          Get connection to a database as configured by the default data source but using explicit user credential.
protected abstract  java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit)
          This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory#requestConnection() to get connection which is not tied to the transactional manager.
protected abstract  java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit, java.lang.String strDataSourceName)
          This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String) to get connection which is not tied to the transactional manager.
protected abstract  java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit, java.lang.String strUser, java.lang.String strPassword)
          This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String, String) to get connection which is not tied to the transactional manager.
protected abstract  java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit, java.lang.String strDataSourceName, java.lang.String strUser, java.lang.String strPassword)
          This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String, String, String) to get connection which is not tied to the transactional manager.
 void returnConnection(java.sql.Connection cntDBConnection)
          Release connection to a database.
abstract  void returnNonTransactionalConnection(java.sql.Connection cntDBConnection)
          This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #returnConnection(java.sql.Connection) to return connection which is not tied to the transactional manager.
 void setDatabaseAdminPassword(java.lang.String strDatabasePassword)
          Sets the database administration password.
 void setDatabaseAdminUser(java.lang.String strDatabaseUser)
          Sets the database administration user.
 void setDatabaseDriver(java.lang.String strDatabaseDriver)
          Sets the database driver identification.
 void setDatabasePassword(java.lang.String strDatabasePassword)
          Sets the database password.
 void setDatabaseURL(java.lang.String strDatabaseURL)
          Sets the database URL.
 void setDatabaseUser(java.lang.String strDatabaseUser)
          Sets the database user.
static void setInstance(DatabaseConnectionFactory dcfDefaultConnectionFactory)
          Set default database connection factory instance.
 void setTransactionFactory(DatabaseTransactionFactoryImpl transactionFactory)
          Set the transaction factory for this connection factory.
 void setUseAdminDataSource(boolean bUseAdminDataSource)
          Sets the flag specifying if to use separate datasource instead just different creadentials to obtain administrator connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.core.persist.db.DatabaseConnectionFactory
addDataSource, debug, getDefaultDataSourceName, getRequestedConnectionCount, getRequestedConnectionCount, isDataSourceDefined, setDefaultDataSourceName, stop
 

Field Detail

DATABASE_DRIVER

public static final java.lang.String DATABASE_DRIVER
Name of the property containing driver to use to connect to the database, e.g. "oracle.jdbc.driver.OracleDriver"

See Also:
Constant Field Values

DATABASE_URL

public static final java.lang.String DATABASE_URL
Name of the property containing URL to connect to the database, e.g. "jdbc:oracle:thin:@server:1521:database"

See Also:
Constant Field Values

DATABASE_USER

public static final java.lang.String DATABASE_USER
Name of the property containing user name to connect to the database, e.g. "bastafidli"

See Also:
Constant Field Values

DATABASE_PASSWORD

public static final java.lang.String DATABASE_PASSWORD
Name of the property containing user password to connect to the database, e.g. "password"

See Also:
Constant Field Values

DATABASE_ADMIN_USER

public static final java.lang.String DATABASE_ADMIN_USER
Name of the property containing user name to connect to the database, as an administrator e.g. "bastafidli"

See Also:
Constant Field Values

DATABASE_ADMIN_PASSWORD

public static final java.lang.String DATABASE_ADMIN_PASSWORD
Name of the property containing user password to connect to the database, as administrator e.g. "password"

See Also:
Constant Field Values

DATABASE_USE_ADMIN_DATAROURCE

public static final java.lang.String DATABASE_USE_ADMIN_DATAROURCE
Name of the property specifying if to use an separate datasource to obtain administration connection instead of just using the default data source with separate credentials. This have to be set to true when using J2EE capabilities in WebLogic 9.x

See Also:
Constant Field Values

DATABASE_USE_ADMIN_DATAROURCE_DEFAULT

public static final boolean DATABASE_USE_ADMIN_DATAROURCE_DEFAULT
Default value for flag specifying if to use separate datasource for admin connections.

See Also:
Constant Field Values

SPY_DRIVER_IDENTIFICATION

public static final java.lang.String SPY_DRIVER_IDENTIFICATION
This string is used to identify JDBC spy driver. If this driver is setup to be used, then we need to lookup real driver as well.

See Also:
Constant Field Values

SPY_CONFIG_FILE_NAME

public static final java.lang.String SPY_CONFIG_FILE_NAME
Name of the configuration file for the spy driver.

See Also:
Constant Field Values

SPY_REALDRIVER

public static final java.lang.String SPY_REALDRIVER
Name of the property which contains identification of real driver user by the spy driver.

See Also:
Constant Field Values

ADMIN_DATASOURCE_NAME

public static final java.lang.String ADMIN_DATASOURCE_NAME
Name that will be used for datasource which should have administration priviledges to setup the database. Make this name somehow meaningful because for example for J2EE CF this name has to be configured in external configuration file.

See Also:
Constant Field Values

m_transactionFactory

protected DatabaseTransactionFactoryImpl m_transactionFactory
This is concrete implementation of database transaction factory, which will be used to manage transactions across connections allocated by this database connection factory. This is a concrete class and not and interface because these two classes are tightly coupled together to make connections transaction aware.


m_iRequestedConnectionCount

protected int m_iRequestedConnectionCount
How many connections were requested and not returned. This is here for debugging purposes to check if somebody is not returning connection.


m_strDatabaseDriver

protected java.lang.String m_strDatabaseDriver
Driver to use to connect to the database, e.g. "com.sap.dbtech.jdbc.DriverSapDB". This can also be spy driver which just wraps around real driver. This spy driver should be used to access to database but if you really need to know what is the real driver, look at the read database driver attribute.

See Also:
m_strRealDatabaseDriver

m_strRealDatabaseDriver

protected java.lang.String m_strRealDatabaseDriver
Real driver which is used to connect to database. This can be wrapper for example in a spy driver.


m_strDatabaseURL

protected java.lang.String m_strDatabaseURL
URL to connect to the database, e.g. "jdbc:oracle:thin:@server:1521:database"

See Also:
DATABASE_URL

m_strDatabaseUser

protected java.lang.String m_strDatabaseUser
User name to connect to the database, e.g. "bastafidli".

See Also:
DATABASE_USER

m_strDatabasePassword

protected java.lang.String m_strDatabasePassword
Password to connect to the database, e.g. "password".

See Also:
DATABASE_PASSWORD

m_strDatabaseAdminUser

protected java.lang.String m_strDatabaseAdminUser
User name with administration priviledges to connect to the database, e.g. "bastafidli".

See Also:
DATABASE_USER

m_strDatabaseAdminPassword

protected java.lang.String m_strDatabaseAdminPassword
Password for user with with administration priviledges to connect to the database, e.g. "password".

See Also:
DATABASE_PASSWORD

m_bUseAdminDataSource

protected boolean m_bUseAdminDataSource
If true then use an separate datasource to obtain administration connection instead of just using the default data source with separate credentials. This have to be set to true when using J2EE capabilities in WebLogic 9.x

See Also:
DATABASE_USE_ADMIN_DATAROURCE
Constructor Detail

DatabaseConnectionFactoryImpl

public DatabaseConnectionFactoryImpl()
Default constructor.


DatabaseConnectionFactoryImpl

public DatabaseConnectionFactoryImpl(DatabaseTransactionFactoryImpl transactionFactory)
Default constructor.

Parameters:
transactionFactory - - transaction factory to use for this connection factory, can be null

DatabaseConnectionFactoryImpl

public DatabaseConnectionFactoryImpl(java.lang.String strDriver,
                                     java.lang.String strURL,
                                     java.lang.String strUser,
                                     java.lang.String strPassword,
                                     DatabaseTransactionFactoryImpl transactionFactory)
                              throws OSSConfigException,
                                     OSSDatabaseAccessException
Constructor with explicitely specified JDBC driver.

Parameters:
strDriver - - JDBC driver to connect to the database
strURL - - URL of database to connect to
strUser - - user name to connect to the database
strPassword - - password to the database
transactionFactory - - transaction factory to use for this connection factory, can be null
Throws:
OSSConfigException - - problem accessing or locating the config file.
OSSDatabaseAccessException - - an error has occured accessing the database
Method Detail

getInstance

public static DatabaseConnectionFactory getInstance()
                                             throws OSSException
Get the default database connection factory. This method is here to make the database connection factory configurable. Once can specify in configuration file derived class to used instead of this one [DatabaseConnectionFactory.class]=new class to use

Returns:
DatabaseConnectionFactory
Throws:
OSSException - - problem connecting to database

setInstance

public static void setInstance(DatabaseConnectionFactory dcfDefaultConnectionFactory)
Set default database connection factory instance. This instance will be returned by getInstance method until it is changed.

Parameters:
dcfDefaultConnectionFactory - - new default database connection factory instance
See Also:
getInstance()

requestConnection

public final java.sql.Connection requestConnection(boolean bAutoCommit)
                                            throws OSSDatabaseAccessException
Get connection to a database as configured by the default data source. The connection has to be explicitely returned using returnConnection most likely in finalize clause.

Specified by:
requestConnection in interface DatabaseConnectionFactory
Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
DatabaseConnectionFactory.returnConnection(java.sql.Connection)

requestConnection

public final java.sql.Connection requestConnection(boolean bAutoCommit,
                                                   java.lang.String strUser,
                                                   java.lang.String strPassword)
                                            throws OSSDatabaseAccessException
Get connection to a database as configured by the default data source but using explicit user credential. The connection has to be explicitely returned using returnConnection most likely in finalize clause.

Specified by:
requestConnection in interface DatabaseConnectionFactory
Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strUser - - user name to connect to the database
strPassword - - password to the database
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
DatabaseConnectionFactory.returnConnection(java.sql.Connection)

requestConnection

public final java.sql.Connection requestConnection(boolean bAutoCommit,
                                                   java.lang.String strDataSourceName)
                                            throws OSSDatabaseAccessException
Get connection to a database as configured by the default data source. The connection has to be explicitely returned using returnConnection most likely in finalize clause. This connection has autocommit set to true so if you do not want to autocommit you need to explicitely reset it. This is mainly because if selects are executed without transaction and transaction isolation is set to for example serializable, it can come to a deadlock since the select may block table when different connection tries to modify it.

Specified by:
requestConnection in interface DatabaseConnectionFactory
Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strDataSourceName - - data source which will be used to get connections
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
DatabaseConnectionFactory.returnConnection(java.sql.Connection)

requestConnection

public final java.sql.Connection requestConnection(boolean bAutoCommit,
                                                   java.lang.String strDataSourceName,
                                                   java.lang.String strUser,
                                                   java.lang.String strPassword)
                                            throws OSSDatabaseAccessException
Get connection to a database as configured by the default data source but using explicit user credential. The connection has to be explicitely returned using returnConnection most likely in finalize clause. This connection has autocommit set to true so if you do not want to autocommit you need to explictely reset it. This is mainly because if selects are executed without transaction and transaction isolation is set to for example serializable, it can come to a deadlock since the select may block table when different connection tries to modify it.

Specified by:
requestConnection in interface DatabaseConnectionFactory
Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strDataSourceName - - data source which will be used to get connections
strUser - - user name to connect to the database
strPassword - - password to the database
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
DatabaseConnectionFactory.returnConnection(java.sql.Connection)

returnConnection

public final void returnConnection(java.sql.Connection cntDBConnection)
Release connection to a database.

Specified by:
returnConnection in interface DatabaseConnectionFactory
Parameters:
cntDBConnection - - connection to a database to release, may be null
See Also:
DatabaseConnectionFactory.requestConnection(boolean)

setTransactionFactory

public void setTransactionFactory(DatabaseTransactionFactoryImpl transactionFactory)
Set the transaction factory for this connection factory. This can be done only if the transaction factory is not set yet (e.g. using constructor).

Parameters:
transactionFactory - - the transaction factory to set.

getDatabaseDriver

public java.lang.String getDatabaseDriver()
Returns the database driver identification.

Specified by:
getDatabaseDriver in interface DatabaseConnectionFactory
Returns:
String

setDatabaseDriver

public void setDatabaseDriver(java.lang.String strDatabaseDriver)
Sets the database driver identification.

Specified by:
setDatabaseDriver in interface DatabaseConnectionFactory
Parameters:
strDatabaseDriver - - The database driver to set

getDatabasePassword

public java.lang.String getDatabasePassword()
Returns the database password.

Specified by:
getDatabasePassword in interface DatabaseConnectionFactory
Returns:
String

setDatabasePassword

public void setDatabasePassword(java.lang.String strDatabasePassword)
Sets the database password.

Specified by:
setDatabasePassword in interface DatabaseConnectionFactory
Parameters:
strDatabasePassword - - The database password to set

getDatabaseURL

public java.lang.String getDatabaseURL()
Returns the database URL.

Specified by:
getDatabaseURL in interface DatabaseConnectionFactory
Returns:
String

setDatabaseURL

public void setDatabaseURL(java.lang.String strDatabaseURL)
Sets the database URL.

Specified by:
setDatabaseURL in interface DatabaseConnectionFactory
Parameters:
strDatabaseURL - - The database URL to set

getDatabaseUser

public java.lang.String getDatabaseUser()
Returns the database user.

Specified by:
getDatabaseUser in interface DatabaseConnectionFactory
Returns:
String

setDatabaseUser

public void setDatabaseUser(java.lang.String strDatabaseUser)
Sets the database user.

Specified by:
setDatabaseUser in interface DatabaseConnectionFactory
Parameters:
strDatabaseUser - - The database user to set

getDatabaseAdminUser

public java.lang.String getDatabaseAdminUser()
Returns the database administration user.

Specified by:
getDatabaseAdminUser in interface DatabaseConnectionFactory
Returns:
String

setDatabaseAdminUser

public void setDatabaseAdminUser(java.lang.String strDatabaseUser)
Sets the database administration user.

Specified by:
setDatabaseAdminUser in interface DatabaseConnectionFactory
Parameters:
strDatabaseUser - - The database user to set

getDatabaseAdminPassword

public java.lang.String getDatabaseAdminPassword()
Returns the database administration password.

Specified by:
getDatabaseAdminPassword in interface DatabaseConnectionFactory
Returns:
String

setDatabaseAdminPassword

public void setDatabaseAdminPassword(java.lang.String strDatabasePassword)
Sets the database administration password.

Specified by:
setDatabaseAdminPassword in interface DatabaseConnectionFactory
Parameters:
strDatabasePassword - - The database password to set

getUseAdminDataSource

public boolean getUseAdminDataSource()
Get the flag specifying if to use separate datasource instead just different creadentials to obtain administrator connection.

Specified by:
getUseAdminDataSource in interface DatabaseConnectionFactory
Returns:
boolean - if true then separate datasource shoud be used for administration connection

setUseAdminDataSource

public void setUseAdminDataSource(boolean bUseAdminDataSource)
Sets the flag specifying if to use separate datasource instead just different creadentials to obtain administrator connection.

Specified by:
setUseAdminDataSource in interface DatabaseConnectionFactory
Parameters:
bUseAdminDataSource - - if true then separate datasource shoud be used for administration connection

loadDefaultDatabaseProperties

public void loadDefaultDatabaseProperties()
                                   throws OSSConfigException,
                                          OSSDatabaseAccessException
Load default database properties such as what driver, user name or password to use from configuration file.

Specified by:
loadDefaultDatabaseProperties in interface DatabaseConnectionFactory
Throws:
OSSConfigException - - problem locating or accessing config file
OSSDatabaseAccessException - - problem accessing the database

getTotalRequestedConnectionCount

public int getTotalRequestedConnectionCount()
Get number for connections which are currently requested and were not returned.

Specified by:
getTotalRequestedConnectionCount in interface DatabaseConnectionFactory
Returns:
int - how many connections were currently requested from pool and were not returned yet.

getRealDatabaseDriver

public java.lang.String getRealDatabaseDriver()
Get real driver name which is used to connect to database. This can be wrapped for example in a spy driver.

Specified by:
getRealDatabaseDriver in interface DatabaseConnectionFactory
Returns:
String - real JDBC driver name.

initializeDriver

protected void initializeDriver(java.lang.String strDatabaseDriver)
                         throws OSSConfigException,
                                OSSDatabaseAccessException
Initialize specified database driver.

Parameters:
strDatabaseDriver - - class name of JDBC driver
Throws:
OSSConfigException - - problem accessing or locating the config file.
OSSDatabaseAccessException - - error initializing the driver

initializeConnection

protected void initializeConnection(java.sql.Connection cntDBConnection,
                                    boolean bAutoCommit)
                             throws java.sql.SQLException
Initialize connection to the default state so it can be used to work with the database. The most common setup is that we will set the autocommit by default to true when transaction is not in progress and to false if there is a pending transaction. This is mainly because if selects are executed without transaction and transaction isolation is set to for example serializable, it can come to a deadlock since the select may block table when different connection tries to modify it.

Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
cntDBConnection - - valid connection to the database
Throws:
java.sql.SQLException - - problem initializing the connection

requestNonTransactionalConnection

protected abstract java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit)
                                                                  throws OSSDatabaseAccessException
This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory#requestConnection() to get connection which is not tied to the transactional manager. This method is protected so that only classes from this package can access it.

Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
returnConnection(java.sql.Connection)

requestNonTransactionalConnection

protected abstract java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit,
                                                                         java.lang.String strUser,
                                                                         java.lang.String strPassword)
                                                                  throws OSSDatabaseAccessException
This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String, String) to get connection which is not tied to the transactional manager. This method is protected so that only classes from this package can access it.

Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strUser - - user name to connect to the database
strPassword - - password to the database
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
returnConnection(java.sql.Connection)

requestNonTransactionalConnection

protected abstract java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit,
                                                                         java.lang.String strDataSourceName)
                                                                  throws OSSDatabaseAccessException
This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String) to get connection which is not tied to the transactional manager. This method is protected so that only classes from this package can access it.

Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strDataSourceName - - data source which will be used to get connections
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
returnConnection(java.sql.Connection)

requestNonTransactionalConnection

protected abstract java.sql.Connection requestNonTransactionalConnection(boolean bAutoCommit,
                                                                         java.lang.String strDataSourceName,
                                                                         java.lang.String strUser,
                                                                         java.lang.String strPassword)
                                                                  throws OSSDatabaseAccessException
This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #requestConnection(String, String, String) to get connection which is not tied to the transactional manager. This method is protected so that only classes from this package can access it.

Parameters:
bAutoCommit - - The desired autocommit state of the connection. If this connection is invoked in global (JTA) transaction then the autocommit is false regardless of what value is specified here. Use true here if the client only reads the data and false if the client also modifies the data. Use DatabaseTransactionFactory.commitTransaction to commit the transaction.
strDataSourceName - - data source which will be used to get connections
strUser - - user name to connect to the database
strPassword - - password to the database
Returns:
Connection - connection to a database, never null
Throws:
OSSDatabaseAccessException - - if connection cannot be established
See Also:
returnConnection(java.sql.Connection)

returnNonTransactionalConnection

public abstract void returnNonTransactionalConnection(java.sql.Connection cntDBConnection)
This method is a delegation method for now final org.opensubsystems.core.persist.db.DatabaseConnectionFactory #returnConnection(java.sql.Connection) to return connection which is not tied to the transactional manager. This method is protected so that only classes from this package can access it.

Parameters:
cntDBConnection - - connection to return, can be null


Copyright © 2003 - 2006 OpenSubsystems s.r.o.