ADO.NET Provider for Veeva Vault

Build 20.0.7587

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 VeevaVaultConnection 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 (VeevaVaultConnection connection = new VeevaVaultConnection("Url=myURL;User=myUser;Password=myPassword;")) {connection.Open();}

using (VeevaVaultConnection connection = new VeevaVaultConnection("PoolIdleTimeout=-1;Url=myURL;User=myUser;Password=myPassword;")) {connection.Open();}

using (VeevaVaultConnection connection = new VeevaVaultConnection("Timeout=15;Url=myURL;User=myUser;Password=myPassword;")) {connection.Open();} //spawns a new pool
VB.NET
Using (VeevaVaultConnection connection = new VeevaVaultConnection("Url=myURL;User=myUser;Password=myPassword;")) 
  connection.Open()
End Using

Using (VeevaVaultConnection connection = new VeevaVaultConnection("PoolIdleTimeout=-1;Url=myURL;User=myUser;Password=myPassword;")) //same connection pool
  connection.Open()
End Using

Using (VeevaVaultConnection connection = new VeevaVaultConnection("Timeout=15;Url=myURL;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.

Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7587