Client Interfaces Guide > TIBCO ADO.NET 2020 Data Provider for TDV > Using ADO.NET > Connection Pooling
 
Connection Pooling
The provider implements a standard ADO.NET connection pool. Set UseConnectionPooling to enable the pool. The following sections show how to configure and use them.
Working with Pooled Connections
Just as you would interact with a non-pooled connection, you use standard ADO.NET objects to get and close connections. But, in this case, the CompositeConnection object retrieved is a handle for the physical connection owned by the connection pool. When the connection is closed, instead of the connection being destroyed, the handle is returned to the pool, where it is available for the next connection request.
You must explicitly close the connection for it to be returned to the pool.
Creating Pooled Connections
The connection pools are based on the unique connection strings except for the Pool properties and any persisted temporary values. The following example instantiates three connections using two distinct connection pools. Two of the connections share the same connection pool, as they share the same connection string.
 
C#
 
using (CompositeConnection connection = new CompositeConnection("Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword")) {connection.Open();}
using (CompositeConnection connection = new CompositeConnection("PoolIdleTimeout=-1;Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword")) {connection.Open();}
using (CompositeConnection connection = new CompositeConnection("Timeout=15;Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword")) {connection.Open();} //spawns a new pool
 
VB.NET
 
Using (CompositeConnection connection = new CompositeConnection("Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword"))
connection.Open()
End Using
Using (CompositeConnection connection = new CompositeConnection("PoolIdleTimeout=-1;Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword")) //same connection pool
connection.Open()
End Using
Using (CompositeConnection connection = new CompositeConnection("Timeout=15;Host=myHost;Domain=myDomain;DataSource=myDataSource;User=myUser;Password=myPassword")) //spawns a new connection pool
connection.Open()
End Using
Closing the Connection Pool
The connection pool is closed when the active process ends.