How to: Use the Telerik® Data Access Integrated Connection Pool
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
A connection pool is a set of database connections that are re-used by clients. Setting up a connection pool improves performance by eliminating client connection times and it is also the preferred method of handling database connections since it provides a more robust handling of error conditions and lost connections than direct manipulation of the connection objects. The default values for various connection pool settings for your Telerik Data Access application can be set using the Backend Configuration -> Connection Pool settings.
When Telerik Data Access Connection Pool pooling is set, Telerik Data Access will handle the Connection Pool internally. Additional features like reserved connections (used for the key generation mechanism) will be handled with these settings. When using the Telerik Data Access Connection Pool you could make use of all the features provided in the dialog.
To not get in conflict with the underlying driver, Telerik Data Access makes some additions to the connection string that is provided by the user. They can be overridden by the user, because the Telerik Data Access additions are added to the beginning of the connection string. The driver will accept the last property that was specified.
For example, when you add a domain model to your project, a new connection string with the following format will be added to the configuration file:
<connectionStrings>
<add name="SofiaCarRental21Connection"
connectionString="data source=.\sqlexpress;initial catalog=SofiaCarRental21;
integrated security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Runtime, Telerik Data Access makes some additions to the connection string. If you start your application in debug mode, you could see that the connection string will have the following format: MultipleActiveResultSets=true;Pooling=false;Enlist=false;data source=.\sqlexpress;initial catalog=SofiaCarRental21;integrated security=True. Three parameters are added to the connection string: MultipleActiveResultSets, Pooling and Enlist.
The connection string could be retrieved by using the OpenAccessContext.Connection property:
using ( EntitiesModel dbContext = new EntitiesModel() )
{
Telerik.OpenAccess.Data.Common.OAConnection dbConnection = dbContext.Connection;
}
Using dbContext As New EntitiesModel()
Dim dbConnection As Telerik.OpenAccess.Data.Common.OAConnection = dbContext.Connection
End Using
You could override the values for these parameters. Just append the new values to the end of the connection string in the config file. For example:
<connectionStrings>
<add name="SofiaCarRental21Connection"
connectionString="data source=.\sqlexpress;initial catalog=SofiaCarRental21;
integrated security=True;MultipleActiveResultSets = False"
providerName="System.Data.SqlClient" />
</connectionStrings>
When you use the Telerik Data Access Connection Pool, please ensure that the Pooling is set to False. This is because, in the integrated mode the connections are pooled internally. There might be conflicts when the driver also uses connection pooling. The connections in the internal mode are not returned to the driver after they get used in the context.
The following table lists all parameters that could be overridden for the specific servers:
Server | Parameter (Default Value) |
Advantage Database Server | Pooling (False) TrimTrailingSpaces (True) |
Firebird | Charset (UTF8) |
MySql | Pooling (False) Convertzerodatetime (True) AutoEnlist = (True) |
Oracle | Pooling (False) Enlist (Dynamic) Unicode is removed |
PostgreSql | Pooling (False) |
SqlServer | Pooling (False) Enlist (False) MultipleActiveResultSets (True) |
SqlAzure | Pooling (False) Enlist (False) MultipleActiveResultSets is not set |
SqlAnywhere | Links (TCP) |
Sql Compact Edition | Enlist (False) FailifMissing (True) |
VistaDB | TransactionMode (Ignore) |