Skip Headers

Oracle® C++ Call Interface Programmer's Guide
10g Release 1 (10.1)

Part Number B10778-01
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
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

ConnectionPool Class

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

Table 10-10 Summary of ConnectionPool Methods

Method Summary
createConnection()
Create a pooled connection.
createProxyConnection()
Create a proxy connection.
getBusyConnections()
Return the number of busy connections in the connection pool.
getIncrConnections()
Return the number of incremental connections in the connection pool.
getMaxConnections()
Return the maximum number of connections in the connection pool.
getMinConnections()
Return the minimum number of connections in the connection pool.
getOpenConnections()
Return the number of open connections in the connection pool.
getPoolName()
Return the name of the connection pool.
getStmtCacheSize()
Retrieves the size of the statement cache.
getTimeOut()
Return the time out period for a connection in the connection pool.
setErrorOnBusy()
Specify that a SQLException should be generated when all connections in the connection pool are busy and no further connections can be opened.
setPoolSize()
Set the minimum, maximum, and incremental number of pooled connections for the connection pool.
setStmtCacheSize()
Retrieves the size of the statement cache.
setTimeOut()
Set the time out period, in seconds, for a connection in the connection pool.
terminateConnection()
Destroy the connection.


createConnection()

Creates a pooled connection.

Syntax Description
Connection* createConnection(
   const string &userName,
   const string &password);
Creates a pooled connection.
Connection* createConnection(
   const UString &username,
   const UString &password);
Creates a globalization enabled pooled connection.

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


createProxyConnection()

Creates a proxy connection from the connection pool.

Syntax Description
Connection* createProxyConnection(
   const string &name,
   Connection::ProxyType proxyType=Connection::PROXY_DEFAULT);
Creates a proxy connection.
Connection* createProxyConnection(
   const UString &name,
   Connection::ProxyType proxyType=Connection::PROXY_DEFAULT);
Creates a globalization enabled proxy connection.
Connection* createProxyConnection(
   const string &name,
   string roles[],
   int numRoles,
   Connection::ProxyType proxyType=Connection::PROXY_DEFAULT);
Creates a proxy connection for several roles.
Connection* createProxyConnection(
   const UString &name,
   std::string roles[],
   unsigned int numRoles,
   Connection::ProxyType proxyType=Connection::PROXY_DEFAULT);
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.
numolesR
The number of roles to activate on the database server.
numolesR
The type of proxy authentication to perform. Valid values are:
  • PROXY_DEFAULT representing a database user name.

  • PROXY_EXTERNAL_AUTH representing an external user name.



getBusyConnections()

Returns the number of busy connections in the connection pool.


Syntax
unsigned int getBusyConnections() const;


getIncrConnections()

Returns the number of incremental connections in the connection pool.


Syntax
unsigned int getIncrConnections() const;


getMaxConnections()

Returns the maximum number of connections in the connection pool.


Syntax
unsigned int getMaxConnections() const;


getMinConnections()

Returns the minimum number of connections in the connection pool.


Syntax
unsigned int getMinConnections() const;


getOpenConnections()

Returns the number of open connections in the connection pool.


Syntax
unsigned int getOpenConnections() const;


getPoolName()

Returns the name of the connection pool.


Syntax
string getPoolName() const;


getStmtCacheSize()

Retrieves the size of the statement cache.


Syntax
unsigned int getStmtCacheSize() const;


getTimeOut()

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


Syntax
unsigned int getTimeOut() const;


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.


Syntax
void setErrorOnBusy();


setPoolSize()

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


Syntax
void setPoolSize(
   unsigned int minConn = 0,
   unsigned int maxConn = 1,
   unsigned int incrConn = 1);
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.


setStmtCacheSize()

Enables or disables statement caching.


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


setTimeOut()

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


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


terminateConnection()

Terminates the pooled connection or proxy connection.


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