Class DBAccess

java.lang.Object
org.eclnt.ccee.db.DBAccess
All Implemented Interfaces:
ICCEEConstants

public class DBAccess extends Object implements 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 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.
  • Constructor Details

    • DBAccess

      public DBAccess()
  • Method Details

    • startIsolationMode

      public static void startIsolationMode()
    • endIsolationMode

      public static void endIsolationMode()
    • initDBConnectionAvailableAtThread

      public static void initDBConnectionAvailableAtThread(IDBConnectionAvailableAtThread dbcaat)
      Initialize the usage of interface IDBConnectionAvailableAtThread.
      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 calling createConnection(String) and then internally attached to the thread, so that subsequent calls tp pickConnection(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

      public static void addCommitRunnable(Runnable r)
    • commitConnection

      public 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". The actual commit is executed within closeConnection(Object) which is called by the highest DBAction instance of a call hierarchy.
      Parameters:
      contextName -
    • rollbackConnection

      public static void rollbackConnection() throws SQLException
      Throws:
      SQLException
    • closeConnection

      public static void closeConnection(Object reference) throws SQLException
      Throws:
      SQLException
    • junit_clearThreadContext

      public static void junit_clearThreadContext()
      Only for JUnit test purposes!
    • createConnection

      public static Connection createConnection(String contextName) throws SQLException
      This method by default is not directly called by the application - because the actual creation of a connection is done within pickConnection(Object, String).

      This method is the one to really create a (new) connection to the database - whereas pickConnection(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

      public static boolean findAutotrim(String contextName)