TDAConnectionManager

From RemObjects Software

Jump to: navigation, search

This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.



Overview

The TDAConnectionManager serves two related purposes.

First, it maintains the list of connections defined for a particular server application and makes them available to the TDASchema and Schema Modeler for design-time purposes.

Secondly, it maintains pools of active connections at runtime, forming the foundation of all server-side database and connection pooling.

While you can edit the connections defined in a connection manager from code or via the Object Inspector using the Connection's collection property, you will usually edit them by double-clicking a TDASchema component that references it, to launch the Schema Modeler.

File

uDAClasses

Declaration

TDAConnectionManager = class(TDAStreamableComponent, IDAConnectionManager, IDAConnectionPool);

Hierarchy

Properties

Property
Type
Description
Connections TDAConnectionCollection Maintains the list of connections (a.k.a. connection strings) defined in the dictionary.
DriverManager TDADriverManager Must reference the application's TDADriverManager instance, which maintains a list of all known database drivers, whether statically linked or dynamically loaded.
MaxPoolSize Defines the maximum number of connections allows in the pool for each connection string. The value of the PoolBehaviour property will control how the pools will behave if the maximum number of connections is reached.
PoolBehaviour TDAPoolBehaviour Manages the pool behavior when the maximum number of connections has been reached. The three available options include:
  • The call to NewConnection will fail with an exception.
  • The call to NewConnection will wait until another connection is freed, and it will then return a connection.
  • The call to NewConnection will return nil.
PoolingEnabled Boolean Enables connection pooling. Default is true. If enabled, the connection manager will maintain a pool of reusable connections, to avoid the overhead of creating and destroying database connections for each request. If disabled, each call to NewConnection will create a new connection to the back-end database, which will be closed when it is released.
PoolSize Integer Returns the current size of the connection pool.
PoolTimeoutSeconds Cardinal After this number seconds of inactivity old connections will be removed from the pool and closed. Default is 60 seconds.
PoolTransactionBehaviour TDAPoolTransactionBehaviour Decides how the pool handles connections that are returned to the pool with an active transaction. The three available options include:
  • No action will be taken.
  • The transaction will be rolled back, losing all changes (recommended).
  • The transaction will be committed, applying all changes to the underlying database.
WaitIntervalSeconds Cardinal Sets the number of seconds that NewConnection will wait between attempts to acquire a new connection, if the pool ix maximized out and PoolBehaviour is set to pbWait.


Methods

Method
Description
ClearPool Removes all connections from the pool. Note that calling ClearPool will not automatically close connections that are currently active; any active connections will remain active until they are released.
NewConnection Returns a new connection, either from the pool or a freshly created one.


Events

Event
Description
OnConnectionAcquired Fires whenever a connection was acquired. This connection could have been freshly created (in which case the OnConnectionCreated event will also fire), or be obtained from a pool.
OnConnectionCreated Fires whenever a new connection was created. The event will not fire if a pooled connection was reused.
OnConnectionFailure Fires if an attempt to acquire a new connection has failed, for whatever reason.
OnConnectionTimedOut Fires when a pooled connection has timed out and will be removed from the pool.


See Also


Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)

ListsGlossaryFeaturesHow ToDriversComponentsToolsSamplesArticlesArchitectureIssues

Personal tools