ConnectionPool Class

Represents an explicit connection pool.

Members

All members of the connection pool.

Methods
Type Method Description

clear([Function]) Method

Removes all connections currently in the connection pool.

getConnection([uid], [pwd], [Function]) Method

Retrieves a new connection from the connection pool, creating a new connection if the pool is empty.

getInUseCount() Method

Returns the number of connections created by the connection pool which are currently in use.

getPooledCount() Method

Returns the number of connections currently in the connection pool.

getProperties() Method

Returns the properties of the connection pool.

setProperties({String | Object}) Method

Sets the properties of the connection pool using a connection properties string or a hash of connection properties parameters passed in as a parameter.

Remarks

Used for applications that create connection pools explicitly. Applications that create connection pools implicitly use the pooling connection property instead.

Example

The following SAP HANA Cloud example creates a connection pool:

var pool = hana.createPool("ServerNode=myhost-hanacloud.ondemand.com:443;uid=myusername;pwd=mypassword");

Create a connection from the pool, which creates a new connection:

var conn = connectionPool.getConnection();

Return the connection to the pool, with the connection staying connected to the server:

conn.disconnect();

Obtain a connection from the pool, which returns the pre-existing connection:

conn = connectionPool.getConnection();

Return the connection to the pool:

conn.disconnect();

Empty the pool, causing the connection to be disconnected from the server:

pool.clear();