ConnectionPool类

ConnectionPool类表示特定数据库的连接池。

createConnection()

创建池连接。(UString为字符集支持)

参数 描述

Connection* createConnection(

const string &userName

const string &password

要连接的用户名。

用户的密码

Connection* createConnection(

const UString &userName

const UString &password

要连接的用户名。

用户的密码

getBusyConnections()

返回连接池中繁忙连接的数目。

语法

unsigned int getBusyConnections() const=0;

getIncrConnections()

返回连接池中的增量连接数。

语法

unsigned int getIncrConnections() const=0;

getMaxConnections()

返回连接池中的最大连接数。

语法

unsigned int getMaxConnections() const=0;

getMinConnections()

返回连接池中的最小连接数。

语法

unsigned int getMinConnections() const=0;

getOpenConnections()

返回连接池中打开的连接数。

语法

unsigned int getOpenConnections() const=0;

getPoolName()

返回连接池的名称。

语法

string getPoolName() const=0;

getTimeOut()

返回连接池中连接的超时时间。

语法

unsigned int getTimeOut() const=0;

setErrorOnBusy()

指定在连接池中的所有连接都处于繁忙状态且不能打开其他连接时生成SQLException。

语法

void setErrorOnBusy()=0;

setTimeOut()

设置连接池中连接的超时时间。ACCI终止任何与此连接池相关的空闲时间超过指定的超时时间的连接。

如果没有设置此属性,那么在需要池空间时,最近最少使用的连接将超时。神通仅在将连接释放回池时检查超时会话。

语法

void setTimeOut(

   unsigned int connTimeOut = 0)=0;
参数 描述
connTimeOut 超时时间,以秒数为单位。

terminateConnection()

终止池连接。

语法

void terminateConnection(

   Connection *connection)=0;
参数 描述
connection 要终止的池连接

terminateConnectionPool()

终止池连接池。

语法

void terminateConnectionPool();