Skip Headers
Oracle® C++ Call Interface Programmer's Guide,
11g Release 2 (11.2)

Part Number E10764-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
LNCPP1008

ConnectionPool Class

The ConnectionPool class represents a pool of connections for a specific database.

LNCPP20821Table 13-13 Summary of ConnectionPool Methods

Method Summary

createConnection()

Creates a pooled connection.

createProxyConnection()

Creates a proxy connection.

getBusyConnections()

Returns the number of busy connections in the connection pool.

getIncrConnections()

Returns the number of incremental connections in the connection pool.

getMaxConnections()

Returns the maximum number of connections in the connection pool.

getMinConnections()

Returns the minimum number of connections in the connection pool.

getOpenConnections()

Returns the number of open connections in the connection pool.

getPoolName()

Returns the name of the connection pool.

getStmtCacheSize()

Retrieves the size of the statement cache.

getTimeOut()

Returns the time out period for a connection in the connection pool.

setErrorOnBusy()

Specifies that a SQLException should be generated when all connections in the connection pool are busy and no further connections can be opened.

setPoolSize()

Sets the minimum, maximum, and incremental number of pooled connections for the connection pool.

setStmtCacheSize()

Enables or disables statement caching.

setTimeOut()

Sets the time out period, in seconds, for a connection in the connection pool.

terminateConnection()

Destroys the connection.


LNCPP20822

createConnection()

Creates a pooled connection.

Syntax Description
Connection* createConnection(
   const string &userName,
   const string &password)=0;
Creates a pooled connection. If the userName and password are both NULL, the connection is externally authenticated.
Connection* createConnection(
   const UString &username,
   const UString &password)=0;
Creates a globalization enabled pooled connection.

Parameter Description
userName
The name of the user with which to connect.
password
The password of the user.

LNCPP20823

createProxyConnection()

Creates a proxy connection from the connection pool.

Syntax Description
Connection* createProxyConnection(
   const string &name,
   Connection::ProxyType 
      proxyType=Connection::PROXY_DEFAULT)=0;
Creates a proxy connection.
Connection* createProxyConnection(
   const UString &name,
   Connection::ProxyType 
      proxyType=Connection::PROXY_DEFAULT)=0;
Creates a globalization enabled proxy connection.
Connection* createProxyConnection(
   const string &name,
   string roles[],
   int numRoles,
   Connection::ProxyType 
      proxyType=Connection::PROXY_DEFAULT)=0;
Creates a proxy connection for several roles.
Connection* createProxyConnection(
   const UString &name,
   string roles[],
   unsigned int numRoles,
   Connection::ProxyType 
      proxyType=Connection::PROXY_DEFAULT)=0;
Creates a globalization enabled proxy connection for several roles.

Parameter Description
name
The user name to connect with.
roles
The roles to activate on the database server.
numRoles
The number of roles to activate on the database server.
proxyType
The type of proxy authentication to perform, ProxyType, defined in Table 13-11. Valid values are:
  • PROXY_DEFAULT representing a database user name.


LNCPP20824

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.

LNCPP20825Syntax

unsigned int getBusyConnections() const=0;
LNCPP20826

getIncrConnections()

Returns the number of incremental connections in the connection pool. When using database resident connection pooling, this is the number of persistent connections to the Connection Broker.

LNCPP20827Syntax

unsigned int getIncrConnections() const=0;
LNCPP20828

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.

LNCPP20829Syntax

unsigned int getMaxConnections() const=0;
LNCPP20830

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.

LNCPP20831Syntax

unsigned int getMinConnections() const=0;
LNCPP20832

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.

LNCPP20833Syntax

unsigned int getOpenConnections() const=0;
LNCPP20834

getPoolName()

Returns the name of the connection pool.

LNCPP20835Syntax

string getPoolName() const=0;
LNCPP20836

getStmtCacheSize()

Retrieves the size of the statement cache.

LNCPP20837Syntax

unsigned int getStmtCacheSize() const=0;
LNCPP20838

getTimeOut()

Returns the time out period of a connection in the connection pool.

LNCPP20839Syntax

unsigned int getTimeOut() const=0;
LNCPP20840

setErrorOnBusy()

Specifies that a SQLException is to be generated when all connections in the connection pool are busy and no further connections can be opened.

LNCPP20841Syntax

void setErrorOnBusy()=0;
LNCPP20842

setPoolSize()

Sets the minimum, maximum, and incremental number of pooled connections for the connection pool.

LNCPP20843Syntax

void setPoolSize(
   unsigned int minConn = 0,
   unsigned int maxConn = 1,
   unsigned int incrConn = 1)=0;
Parameter Description
minConn
The minimum number of connections for the connection pool.
maxConn
The maximum number of connections for the connection pool.
incrConn
The incremental number of connections for the connection pool.

LNCPP20844

setStmtCacheSize()

Enables or disables statement caching. A nonzero value enables statement caching, with a cache of specified size. A zero value disables caching.

LNCPP20845Syntax

void setStmtCacheSize(
   unsigned int cacheSize)=0;
Parameter Description
cacheSize
The size of the statement cache.

LNCPP20846

setTimeOut()

Sets the time out period for a connection in the connection pool. OCCI terminates any connections related to this connection pool that have been idle for longer than the time out period specified.

If this attribute is not set, the least recently used sessions are timed out when pool space is required. Oracle only checks for timed out sessions when it releases a session back to the pool.

LNCPP20847Syntax

void setTimeOut(
   unsigned int connTimeOut = 0)=0;
Parameter Description
connTimeOut
The timeout period in number of seconds.

LNCPP20848

terminateConnection()

Terminates the pooled connection or proxy connection.

LNCPP20849Syntax

void terminateConnection(
   Connection *connection)=0;
Parameter Description
connection
The pooled connection or proxy connection to terminate.

Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Page

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF