KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: On Server Open / Close Connection Database Method Execution Context
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: May 31, 2017

The On Server Open Connection or On Server Close Connection database methods are called for any "4D Client Process" that runs on the 4D Server. The "4D Client Process" is the TWIN process that exists on the server, corresponding to a process running on the 4D Client.

Both of these database methods are executed in the same context as the TWIN process. The On Server Open Connection database method runs prior to executing any code defined in the project method while the On Server Close Connection database method runs after executing the code defined in the project method.

For example, if a 4D Client runs code that needs a twin process on the 4D Server - the execution cycle might look like this:

  1. A new process is created on the 4D Server.
  2. The On Server Open Connection database method code executes in this new process
  3. The code defined in the method executes in this same process
  4. The On Server Close Connection database method code executes in this same process
  5. The process finishes