Skip to Content

SAPConnectionPool - How to use

I must not be understanding something about the pooling in the .Net Connector 2.0. I am trying to limit the number of connections that can be made to SAP. I want to have a pool of 2 (example) connections. Here is a sample which allows 5 connections (and will allow more) even though I set the MaxCapacity to 2.

any help is appreciated.

Philip Johnston

SAP.Connector.Config.Instance.ConnectionPool.MaxCapacity = 2;

proxy1.Connection = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(this.destination1.ConnectionString);

proxy2.Connection = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(this.destination1.ConnectionString);

proxy3.Connection = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(this.destination1.ConnectionString);

proxy4.Connection = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(this.destination1.ConnectionString);

proxy5.Connection = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(this.destination1.ConnectionString);

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 05, 2005 at 12:54 AM

    I added the following to the config file:







    CleanupInterval="20" />



    I am still able to get as many connections from the pool as I request. Why am I not being limited to the 2???

    Add a comment
    10|10000 characters needed characters exceeded

    • You are mixing the MaxCapacity with MaxOpenConnections.

      If you want to limit the possible load on your servers, you use MaxOpenConnections. If the limit is reached, connection.Open will block (note, not GetConnection, GetNewConnection or GetConnectionFromPool do block, but the Open call on the new connection).

      MaxCapacity is used to automatically close the oldes (unused) connection in the pool if a ReturnConnection would create mire than the specified MaxCapacity.

      That the Web.config snipped didn't have an effect might be caused by forgetting to register the section handler.

      Here is the full example (from NCo docu, ms-help://MS.VSCC.2003/SAP.NCO/NCOV2Docu/reference/SAP.Connector.Config.html )


      <sectionGroup name="SAP">

      <section name="Connector" type="SAP.Connector.SectionHandler, SAP.Connector, Version=, Culture=neutral, PublicKeyToken=50436dca5c7f7d23"/>






      <Trace Level="Info" File="Test.trc"/>





      CleanupInterval="20" />


      <Program Name="Test" Allowed="true"/>

      <Program Name="Test2" Allowed="false"/>


      <Destinations Default="DIP">


















Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.