cancel
Showing results for 
Search instead for 
Did you mean: 

Connection Pooling configuration in .NET Connector 2.0

Former Member
0 Kudos

Hi.

I am writing an application in C# that connects to SAP as a client

and a server using the SAP .NET connector 2.0.

How do I configure connection pooling for the .NET connector

(switch it on /off, set the paramters etc.) ?

What are the default values for the connection pooling

parameters ?

Can anyone give me some excample code or links that could

give me information about this subject ?

Thanks a lot to everyone in advance.

Best regards,

Fred

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Alfred,

You can find detailed information in .net help searching SAP, Connection Pool.

I want to explain with an example ;


<configuration>
<SAP>
    <Connector>
           <ConnectionPool UseAutoPooling="True" MaxOpenConnections="100" MaxCapacity="5" MaxIdleTime="200"/>
    </Connector>
</SAP>
</configuration>

You need to insert these SAP tags under configuration in web.config file. The parameters are ;

UseAutoPooling - You are saying that I will use Connection Pool

MaxOpenConnections - saying that at any time, maximum open connection number will be 100

MaxCapacity - You are saying that Connection Pool will hold maximum 5 open connection in pool

MaxIdleTime - You are saying that, an open connection in pool will be deleted after 200 minutes when connection returned to pool.

In your code, you are using Connector.GetConnectionFromPool() and ReturnConnectionToPool, maybe the method names are wrong, you can look at details these methods.

ps : Don't forget to give rewarding points if helpful

Best Regards,

Huseyin Akturk

SW Engineer & SAP ABAP Consultant

www.huseyinakturk.net

Former Member
0 Kudos

Hi,

The SAP.Connector.Config class has several nested parameters which can be used to configure the Connection Pool.

You can keep the settings in Web.Config something like-

<sectionGroup name="SAP">

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

</sectionGroup>

<SAP>

<Connector>

<ConnectionPool

UseAutoPooling="True"

MaxIdleTime="25"

MaxCapacity="45"

/>

</Connector>

</SAP>

Parameters are-

CleanupInterval

MaxCapacity

MaxOpenConnections

UseAutoPooling

MaxIdleTime

You can set the values of these parameters depending upon your application requriement.

Then in the code you can use method SAP.Connector.Connection.GetConnectionFromPool () to get an unused connection (or create a new one if there is none) and SAP.Connector.Connection.ReturnConnection () to put it back into pool.

Regards.