on 02-04-2005 11:53 PM
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);
I added the following to the config file:
<SAP>
<Connector>
<ConnectionPool
MaxOpenConnections="2"
MaxCapacity="2"
MaxIdleTime="10"
CleanupInterval="20" />
</Connector>
</SAP>
I am still able to get as many connections from the pool as I request. Why am I not being limited to the 2???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 )
<configSections>
<sectionGroup name="SAP">
<section name="Connector" type="SAP.Connector.SectionHandler, SAP.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=50436dca5c7f7d23"/>
</sectionGroup>
</configSections>
...
<SAP>
<Connector>
<Trace Level="Info" File="Test.trc"/>
<ConnectionPool
MaxOpenConnections="200"
MaxCapacity="20"
MaxIdleTime="10"
CleanupInterval="20" />
<AllowedToStart>
<Program Name="Test" Allowed="true"/>
<Program Name="Test2" Allowed="false"/>
</AllowedToStart>
<Destinations Default="DIP">
<Entry
DestinationName="DIP"
AppServerHost="iwdf9015"
SystemNumber="00"
Username="lig"
Password="ides"
Client="800"/>
<Entry
DestinationName="BCE"
AppServerHost="bcemain"
SystemNumber="26"
Username="rfctest"
Password="ides"
Client="000"/>
</Destinations>
</Connector>
</SAP>
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.