Micro Focus Content Manager SDK 10.1
TRIM.SDK.DatabaseConnectionPool Class Reference

Provides configuration of the global database connection pool. Because the database connection pool is global, only a single instance of the DatabaseConnectionPool class may be created. The global database connection pool allows you to reuse network connections across multiple Database objects. Calling Database.Connect() is a relatively expensive operation, especially in applications that create a potentially large number of Database objects. The database connection pool optimizes this by caching network connections and reusing them in subsequent Database.Connect() calls. When a Database object is disposed, the connection is automatically returned to the database connection pool. Connection pooling operates transparently, but only applies for Database objects for which the Id, WorkgroupServerName and TrustedUser properties have been set. Note that all three of these properties must be set, for connection pooling to be enabled. The DatabaseConnectionPool class implements the IDisposable interface. DatabaseConnectionPool objects must be properly disposed by your program, either by calling Dispose () in a 'finally' clause, or with a 'using' clause. More...

Inheritance diagram for TRIM.SDK.DatabaseConnectionPool:

Public Member Functions

void Dispose ()
 
 DatabaseConnectionPool ()
 Constructs an instance of the DatabaseConnectionPool class. More...
 
 DatabaseConnectionPool (int maxConnections)
 Constructs an instance of the DatabaseConnectionPool class, with the specified maximum connection limit. More...
 
void Flush ()
 Clears all idle connections from the pool. More...
 

Properties

int MaxConnectionAge [get, set]
 Gets or sets the maximum allowed time (in seconds) that a database connection may remain idle in the pool. The time is measured from the point when the database connection was last returned to the pool. More...
 
int MaxConnectionCount [get, set]
 Gets or sets the maximum number of connections allowed in the pool. More...
 
int IdleConnectionCount [get]
 Gets the current number of idle connections in the pool. More...
 
int BusyConnectionCount [get]
 Gets the current number of busy connections in the pool. More...
 

Detailed Description

Provides configuration of the global database connection pool. Because the database connection pool is global, only a single instance of the DatabaseConnectionPool class may be created.

The global database connection pool allows you to reuse network connections across multiple Database objects. Calling Database.Connect() is a relatively expensive operation, especially in applications that create a potentially large number of Database objects. The database connection pool optimizes this by caching network connections and reusing them in subsequent Database.Connect() calls. When a Database object is disposed, the connection is automatically returned to the database connection pool.

Connection pooling operates transparently, but only applies for Database objects for which the Id, WorkgroupServerName and TrustedUser properties have been set. Note that all three of these properties must be set, for connection pooling to be enabled.

The DatabaseConnectionPool class implements the IDisposable interface. DatabaseConnectionPool objects must be properly disposed by your program, either by calling Dispose () in a 'finally' clause, or with a 'using' clause.

Constructor & Destructor Documentation

◆ DatabaseConnectionPool() [1/2]

TRIM.SDK.DatabaseConnectionPool.DatabaseConnectionPool ( )

Constructs an instance of the DatabaseConnectionPool class.

◆ DatabaseConnectionPool() [2/2]

TRIM.SDK.DatabaseConnectionPool.DatabaseConnectionPool ( int  maxConnections)

Constructs an instance of the DatabaseConnectionPool class, with the specified maximum connection limit.

Member Function Documentation

◆ Dispose()

void TRIM.SDK.DatabaseConnectionPool.Dispose ( )

◆ Flush()

void TRIM.SDK.DatabaseConnectionPool.Flush ( )

Clears all idle connections from the pool.

Property Documentation

◆ BusyConnectionCount

int TRIM.SDK.DatabaseConnectionPool.BusyConnectionCount
get

Gets the current number of busy connections in the pool.

◆ IdleConnectionCount

int TRIM.SDK.DatabaseConnectionPool.IdleConnectionCount
get

Gets the current number of idle connections in the pool.

◆ MaxConnectionAge

int TRIM.SDK.DatabaseConnectionPool.MaxConnectionAge
getset

Gets or sets the maximum allowed time (in seconds) that a database connection may remain idle in the pool. The time is measured from the point when the database connection was last returned to the pool.

◆ MaxConnectionCount

int TRIM.SDK.DatabaseConnectionPool.MaxConnectionCount
getset

Gets or sets the maximum number of connections allowed in the pool.