Pooling with the OLE DB .NET Data Provider

Pooling with the OLE DB .NET Data Provider


The OLE DB .NET Data Provider pools connections by using the underlying services of OLE DB resource pooling. You have a number of options for configuring resource pooling:
  • You can use the connection string to configure, enable, or disable resource pooling.
  • You can use the registry.
  • You can programmatically configure resource pooling.
To circumvent registry-related deployment issues, avoid using the registry to configure OLE DB resource pooling.

Managing Connection Pooling with Pooled Objects


As Windows DNA developers, you were encouraged to disable OLE DB resource pooling and/or ODBC connection pooling and use COM+ object pooling as a technique to pool database connections. There are two primary reasons for this:
  • Pool sizes and thresholds can be explicitly configured (in the COM+ catalog).
  • Performance is improved. The pooled object approach can outperform native pooling by a factor of two.
However, because the SQL Server .NET Data Provider uses pooling internally, you no longer need to develop your own object pooling mechanism (when using this provider). You can thus avoid the complexities associated with manual transaction enlistment. You might want to consider COM+ object pooling if you are using the OLE DB .NET Data Provider to benefit from superior configuration and improved performance. If you develop a pooled object for this purpose, you must disable OLE DB resource pooling and automatic transaction enlistment (for example, by including "OLE DB Services=-4" in the connection string). You must handle transaction enlistment within your pooled object implementation.