Skip Headers

Oracle C++ Call Interface Programmer's Guide
Release 2 (9.2)

Part Number A96583-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

OCCI Classes and Methods, 7 of 22


ConnectionPool Class

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

To create a connection pool, use the syntax:

ConnectionPool();

Summary of ConnectionPool Methods

Table 8-7 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.

getTimeOut()

Return the time-out period for a connection in the connection pool.

setErrorOnBusy()

Specify that a SQLException is to 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.

setTimeOut()

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

terminateConnection()

Destroy the connection.

createConnection()

This method creates a pooled connection.

Syntax
Connection* createConnection(const string &userName,
   const string &password);
Parameters
userName

The name of the user to connect as.

password

The password of the user.

createProxyConnection()

This method creates a proxy connection from the connection pool.

Syntax

There are variants of syntax:

Connection* createProxyConnection(cont string &name,
   Connection::ProxyType proxyType = Connection::PROXY_DEFAULT);
Connection* createProxyConnection(const string &name,
   string roles[],
   int numRoles,
   Connection::ProxyType proxyType = Connection::PROXY_DEFAULT);
Parameters
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.

Valid values are:

PROXY_DEFAULT representing a database user name.

PROXY_EXTERNAL_AUTH representing an external user name.

getBusyConnections()

This method returns the number of busy connections in the connection pool.

Syntax
unsigned int getBusyConnections() const;

getIncrConnections()

This method returns the number of incremental connections in the connection pool.

Syntax
unsigned int getIncrConnections() const;

getMaxConnections()

This method returns the maximum number of connections in the connection pool.

Syntax
unsigned int getMaxConnections() const;

getMinConnections()

This method returns the minimum number of connections in the connection pool.

Syntax
unsigned int getMinConnections() const;

getOpenConnections()

This method returns the number of open connections in the connection pool.

Syntax
unsigned int getOpenConnections() const;

getPoolName()

This method returns the name of the connection pool.

Syntax
string getPoolName() const;

getTimeOut()

This method returns the time-out period of a connection in the connection pool.

Syntax
unsigned int getTimeOut() const;

setErrorOnBusy()

This method 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()

This method 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);
Parameters
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.

setTimeOut()

This method 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
connTimeOut

The time-out period in number of seconds.

terminateConnection()

This method terminates the pooled connection or proxy connection.

Syntax
void terminateConnection(Connection *connection);
Parameter
connection

The pooled connection or proxy connection to terminate.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback