Package org.eclnt.ccee.db
Class DBAccess
java.lang.Object
org.eclnt.ccee.db.DBAccess
- All Implemented Interfaces:
ICCEEConstants
Class for accessing the database - i.e. for building up the connection to the
database.
This class is in general not directly used by the application processing. Applications must implicitly or explicitly use the
An implicit creation of a
This class is in general not directly used by the application processing. Applications must implicitly or explicitly use the
DBAction
in order
to implicitly access the functions of this class. An implicit creation of a
DBAction
is done by any DOFWSql
method that is called to read or update date.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Data structure that is passed back when picking a connection.static class
static class
-
Field Summary
Fields inherited from interface org.eclnt.ccee.ICCEEConstants
AND, ASC, AVG, BETWEEN, BRC, BRO, COUNT, DEFAULT_CONTEXT, DESC, FUNCTIONRESULT, GREATER, GREATEREQUAL, IN, IS, ISNOT, LIKE, LL_DBG, LL_ERR, LL_INF, LL_WAR, LOWER, LOWEREQUAL, MAX, MIN, NULL, OR, ORDERBY, QPFUNCTION_LOWER, QPFUNCTION_UPPER, SUM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
closeConnection
(Object reference) static void
commitConnection
(String contextName) The commit does not actually perform the commit to the database but marks the current Thread context as "commit required".static Connection
createConnection
(String contextName) This method by default is not directly called by the application - because the actual creation of a connection is done withinpickConnection(Object, String)
.static void
static boolean
findAutotrim
(String contextName) static int
Number of connections that are currently in application use.static void
Initialize the usage of interfaceIDBConnectionAvailableAtThread
.static void
initUsePooledConnectionByDefault
(boolean value) Global flag how to deal with connection pooling if there is no explicit definition within configuration.static void
Only for JUnit test purposes!pickConnection
(Object reference, String contextName) Checks if there is a connection used within the current thread processing.static void
static void
-
Constructor Details
-
DBAccess
public DBAccess()
-
-
Method Details
-
startIsolationMode
public static void startIsolationMode() -
endIsolationMode
public static void endIsolationMode() -
initDBConnectionAvailableAtThread
Initialize the usage of interfaceIDBConnectionAvailableAtThread
.- Parameters:
dbcaat
-
-
initUsePooledConnectionByDefault
public static void initUsePooledConnectionByDefault(boolean value) Global flag how to deal with connection pooling if there is no explicit definition within configuration. The definition of the configuration will always override this default definition. -
pickConnection
public static DBAccess.PickConnectionResult pickConnection(Object reference, String contextName) throws SQLException Checks if there is a connection used within the current thread processing. If no then the connection will be created by callingcreateConnection(String)
and then internally attached to the thread, so that subsequent calls tppickConnection(Object, String)
will use one and the same connection instance.- Throws:
SQLException
-
getCurrentNumberOfUserConnections
public static int getCurrentNumberOfUserConnections()Number of connections that are currently in application use. In case of using the connection buffer: buffered connections are not part of the result of this method. -
addCommitRunnable
-
commitConnection
The commit does not actually perform the commit to the database but marks the current Thread context as "commit required". The actual commit is executed withincloseConnection(Object)
which is called by the highestDBAction
instance of a call hierarchy.- Parameters:
contextName
-
-
rollbackConnection
- Throws:
SQLException
-
closeConnection
- Throws:
SQLException
-
junit_clearThreadContext
public static void junit_clearThreadContext()Only for JUnit test purposes! -
createConnection
This method by default is not directly called by the application - because the actual creation of a connection is done withinpickConnection(Object, String)
.
This method is the one to really create a (new) connection to the database - whereaspickConnection(Object, String)
first checks if there is some connection context available and by this ensures that one and the same connection instance is used within the processing of an application.- Throws:
SQLException
-
findAutotrim
-