Micro Focus Content Manager SDK 9.4
HP.HPTRIM.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 HP.HPTRIM.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

HP.HPTRIM.SDK.DatabaseConnectionPool.DatabaseConnectionPool ( )

Constructs an instance of the DatabaseConnectionPool class.

HP.HPTRIM.SDK.DatabaseConnectionPool.DatabaseConnectionPool ( int  maxConnections)

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

Member Function Documentation

void HP.HPTRIM.SDK.DatabaseConnectionPool.Dispose ( )
void HP.HPTRIM.SDK.DatabaseConnectionPool.Flush ( )

Clears all idle connections from the pool.

Property Documentation

int HP.HPTRIM.SDK.DatabaseConnectionPool.BusyConnectionCount
get

Gets the current number of busy connections in the pool.

int HP.HPTRIM.SDK.DatabaseConnectionPool.IdleConnectionCount
get

Gets the current number of idle connections in the pool.

int HP.HPTRIM.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.

int HP.HPTRIM.SDK.DatabaseConnectionPool.MaxConnectionCount
getset

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