13.29 StatelessConnectionPool Class
This class represents a pool of stateless, authenticated connections to the database.
Table 13-41 Enumerated Values Used by StatelessConnectionPool Class
Attribute | Options |
---|---|
PoolType |
|
BusyOption |
|
DestroyMode |
|
Table 13-42 Summary of StatelessConnectionPool Methods
Method | Description |
---|---|
Returns a pointer to the connection object, without the restriction of a matching tag. |
|
Returns a proxy connection from a connection pool. |
|
Returns the number of busy connections in the connection pool. |
|
Returns the behavior of the stateless connection pool when all the connections in the pool are busy and the number of connections have reached maximum |
|
Returns a pointer to the |
|
Returns the number of incremental connections in the connection pool. |
|
Returns the maximum number of connections in the connection pool. |
|
Returns the minimum number of connections in the connection pool. |
|
Returns the number of open connections in the connection pool. |
|
Returns the name of the connection pool. |
|
Returns a proxy connection from a connection pool. |
|
Returns the timeout period of a connection in the connection pool. |
|
Releases the connection back to the pool with an optional tag. |
|
Specifies the behavior of the stateless connection pool when:
|
|
Sets the maximum, minimum, and incremental number of pooled connections for the connection pool. |
|
Sets the timeout period of a connection in the connection pool. |
|
Closes the connection and remove it from the pool. |
13.29.1 getAnyTaggedConnection()
Returns a pointer to the connection object, without the restriction of a matching tag.
This method works in an environment with enabled database resident connection pooling.
During the execution of this call, the pool is first searched based on the tag provided. If a connection with the specified tag exists, it is returned to the user. If a matching connection is not available, an appropriately authenticated untagged connection (with a NULL
tag) is returned. In cases where an undated connection is not free, an appropriately authenticated connection with a different tag is returned.
A getTag()
call to the Connection
verifies that the connection tag is received.
Syntax | Description |
---|---|
Connection *getAnyTaggedConnection( string &tag="")=0; |
Returns a pointer to the connection object from a homogeneous stateless connection pool, without the restriction of a matching tag; |
Connection* getAnyTaggedConnection( const UString &tag)=0; |
Returns a pointer to the connection object from a homogeneous stateless connection pool, without the restriction of a matching tag; |
Connection *getAnyTaggedConnection( const string &userNname, const string &password, const string &tag="")=0; |
Returns a pointer to the connection object from a heterogeneous stateless connection pool, without the restriction of a matching tag; |
Connection* getAnyTaggedConnection( const UString &userName, const UString &Password, const UString &tag)=0 ; |
Returns a pointer to the connection object from a heterogeneous stateless connection pool, without the restriction of a matching tag; |
Parameter | Description |
---|---|
userName |
The database username |
password |
The database password. |
tag |
User-defined type of connection requested. This parameter can be ignored if a default connection is requested. |
13.29.2 getAnyTaggedProxyConnection()
Returns a proxy connection from a connection pool.
This method works in an environment with enabled database resident connection pooling.
During the execution of this call, the pool is first searched based on the tag provided. If a connection with the specified tag exists, it is returned to the user. If a matching connection is not available, an appropriately authenticated connection with a different tag is returned. In cases where an undated connection is not free, an appropriately authenticated connection with a different tag is returned.
Restrictions for matching the tag may be removed by passing an empty tag argument parameter.
A getTag()
call to the connection verifies the connection tag received.
Syntax | Description |
---|---|
Connection *getAnyTaggedProxyConnection( const string &name, string roles[], unsigned int numRoles, const string tag="", Connection::ProxyType proxyType=Connection::PROXY_DEFAULT); |
Get a proxy connection with role specifications from a connection pool; includes support for roles and |
Connection* getAnyTaggedProxyConnection( const UString &name, string roles[], unsigned int numRoles, const UString &tag, Connection::ProxyType proxyType = Connection::PROXY_DEFAULT); |
Get a proxy connection with role specifications from a connection pool; includes support for roles and |
Connection *getAnyTaggedProxyConnection( const string &name, const string tag="", Connection::ProxyType proxyType=Connection::PROXY_DEFAULT); |
Get a proxy connection with role specifications from a connection pool; |
Connection* getAnyTaggedProxyConnection( const UString &name, const UString &tag, Connection::ProxyType proxyType = Connection::PROXY_DEFAULT); |
Get a proxy connection within role specifications from the connection pool; |
Parameter | Description |
---|---|
name |
The username. |
roles |
The roles to activate on the database server |
numRoles |
The number of roles to activate on the database server |
tag |
User defined tag associated with the connection. |
proxyType |
The type of proxy authentication to perform; |
13.29.3 getBusyConnections()
Returns the number of busy connections in the connection pool. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.
Syntax
unsigned int getBusyConnections() const=0;
13.29.4 getBusyOption()
Returns the behavior of the stateless connection pool when all the connections in the pool are busy, and when the number of connections have reached maximum. The return values are defined for BusyOption
in Table 13-41.
Syntax
BusyOption getBusyOption()=0;
13.29.5 getConnection()
Returns a pointer to the connection object of a StatelessConnectionPool
.
This method works in an environment with enabled database resident connection pooling.
Syntax | Description |
---|---|
Connection *getConnection()=0; |
Returns a connection that can be authenticated externally. |
Connection *getConnection( string &tag="")=0; |
Returns an authenticated connection, with a connection pool username and password; |
Connection* getConnection( const UString &tag)=0; |
Returns an authenticated connection, with a connection pool username and password; |
Connection *getConnection( const string &userName, const string &password, const string &tag="")=0; |
Returns a pointer to the connection object from a heterogeneous stateless connection pool; |
Connection* getConnection( const UString &userName, const UString &password, const UString &tag)=0; |
Returns a pointer to the connection object from a heterogeneous stateless connection pool; |
Connection *getConnection( const string &connectionClass, const Connection::Purity &purity)=0; |
Returns a pointer to the connection object from a database resident connection pool; |
Connection* getConnection( const UString &connectionClass, const Connection::Purity &purity)=0; |
Returns a pointer to the connection object from a database resident connection pool; |
Connection *getConnection( const string &userName, const string &password, const string &connectionClass, const Connection::Purity &purity)=0; |
Returns a pointer to the connection object from a database resident connection pool; user name and password authentication; |
Connection* getConnection( const UString &userName, const UString &password, const UString &connectionClass, const Connection::Purity &purity)=0; |
Returns a pointer to the connection object from a database resident connection pool; user name and password authentication; |
Connection *getConnection( const string &connectionClass, const Connection::Purity &purity, const string &tag)=0; |
Returns a tagged connection object from a database resident connection pool; |
Connection* getConnection( const UString &connectionClass, const Connection::Purity &purity, const UString &tag)=0; |
Returns a tagged connection object from a database resident connection pool; |
Parameter | Description |
---|---|
userName |
The database username. |
password |
The database password. |
tag |
The user defined tag associated with the connection. During the call, the pool is first searched based on the tag provided. If a connection with the specified tag exists it is returned; otherwise a new connection is created and returned. |
connectionClass |
The class of connection used by database resident connection pool. |
purity |
The purity of connection used by database resident connection pool; either |
13.29.6 getIncrConnections()
Returns the number of incremental connections in the connection pool. This call is useful only in cases of homogeneous connection pools. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.
Syntax
unsigned int getIncrConnections() const=0;
13.29.7 getMaxConnections()
Returns the maximum number of connections in the connection pool. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.
Syntax
unsigned int getMaxConnections() const=0;
13.29.8 getMinConnections()
Returns the minimum number of connections in the connection pool. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.
Syntax
unsigned int getMinConnections() const=0;
13.29.9 getOpenConnections()
Returns the number of open connections in the connection pool. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.
Syntax
unsigned int getOpenConnections() const=0;
13.29.10 getPoolName()
Returns the name of the connection pool.
Syntax
string getPoolName() const=0;
13.29.11 getProxyConnection()
Returns a proxy connection from a connection pool.
This method works in an environment with enabled database resident connection pooling.
Syntax | Description |
---|---|
Connection *getProxyConnection( const string &userName, string roles[], unsigned int numRoles, const string& tag="", Connection::ProxyType proxyType=Connection::PROXY_DEFAULT)=0; |
Get a proxy connection with role specifications from a connection pool; support for roles and |
Connection* getProxyConnection( const UString &userName, UString roles[], unsigned int numRoles, const UString &tag, Connection::ProxyType proxyType = Connection::PROXY_DEFAULT); |
Get a proxy connection with role specifications from a connection pool; support for roles and |
Connection *getProxyConnection( const string &userName, const string &connectionClass, const Connection::Purity &purity)=0; |
Get a proxy connection from a database resident connection pool; |
Connection *getProxyConnection( const UString &userName, const UString &connectionClass, const Connection::Purity &purity)=0; |
Get a proxy connection from a database resident connection pool; |
Connection *getProxyConnection( const string &userName, string roles[], unsigned int numRoles, const string &connectionClass, const Connection::Purity &purity)=0; |
Get a proxy connection with role specifications from a connection pool; support for roles and database resident connection pooling; |
Connection* getProxyConnection( const UString &userName, UString roles[], unsigned int numRoles, const UString &connectionClass, const Connection::Purity &purity)=0; |
Get a proxy connection with role specifications from a connection pool; support for roles and database resident connection pooling; |
Connection *getProxyConnection( const string &userName, const string& tag="", Connection::ProxyType proxyType=Connection::PROXY_DEFAULT)=0; |
Get a proxy connection without role specifications from a connection pool; |
Connection* getProxyConnection( const UString &userName, const UString &tag, Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) |
Get a proxy connection without role specifications from a connection pool; |
Parameter | Description |
---|---|
userName |
The user name. |
roles |
The roles to activate on the database server. |
numRoles |
The number of roles to activate on the database server. |
tag |
The user defined tag associated with the connection. During the execution of this call, the pool is first searched based on the tag provided. If a connection with the specified tag exists it is returned; otherwise, a new connection is created and returned. |
proxyType |
The type of proxy authentication to perform; |
connectionClass |
The class of connection used by database resident connection pool. |
purity |
The purity of connection used by database resident connection pool; either |
13.29.12 getStmtCacheSize()
Retrieves the size of the statement cache.
Syntax
unsigned int getStmtCacheSize() const=0;
13.29.13 getTimeOut()
Returns the timeout period of a connection in the connection pool.
Syntax
unsigned int getTimeOut() const=0;
13.29.14 releaseConnection()
Releases the connection back to the pool with an optional tag.
This method works in an environment with enabled database resident connection pooling.
Syntax | Description |
---|---|
void releaseConnection( Connection *connection, const string& tag=""); |
Support for |
void releaseConnection( Connection *connection, const UString &tag); |
Support for |
Parameter | Description |
---|---|
connection |
The connection to be released. |
tag |
The user defined tag associated with the connection. The default of this parameter is |
13.29.15 setBusyOption()
Specifies the behavior of the stateless connection pool when all the connections in the pool are busy, and when the number of connections have reached maximum.
Syntax
void setBusyOption( BusyOption busyOption)=0;
Parameter | Description |
---|---|
busyOption |
Valid values are defined in |
13.29.16 setPoolSize()
Sets the maximum, minimum, and incremental number of pooled connections for the connection pool.
Syntax
void setPoolSize( unsigned int maxConn=1, unsigned int minConn=0, unsigned int incrConn=1)=0;
Parameter | Description |
---|---|
maxConn |
The maximum number of connections in the connection pool. |
minConn |
The minimum number of connections, in homogeneous pools only. |
incrConn |
The incremental number of connections, in homogeneous pools only. |
13.29.17 setTimeOut()
Sets the time out period of a connection in the connection pool. OCCI terminates any connections related to this connection pool that have been idle for longer than the timeout period specified.
If this attribute is not set, the least recently used connection is timed out when pool space is required. Oracle only checks for timed out connections when it releases a connection back to the pool.
Syntax
void setTimeOut( unsigned int connTimeOut=0)=0;
Parameter | Description |
---|---|
connTimeOut |
The time out period, given in seconds. |
13.29.18 setStmtCacheSize()
Enables or disables statement caching. A nonzero value enables statement caching, with a cache of specified size. A zero value disables caching.
If the user changes the cache size of individual connections and subsequently returns the connection back to the pool with a tag, the cache size does not revert to the one set for the pool. If the connection is untagged, the cache size is reset to equal the cache size specified for the pool.
Syntax
void setStmtCacheSize( unsigned int cacheSize)=0;
Parameter | Description |
---|---|
cacheSize |
The size of the statement cache |