# Connection Pooling

## Content



ADO.NET provider for Kintone implements connection pooling to reduce the efforts of repeatedly opening and closing connections. A connection pool is a cache of database connections maintained where the user can reuse existing active connections with the same connection string instead of creating new connections when a request is made to the database.

Connection pools are used to enhance the performance of executing commands on a database. The provider supports pooling, by default with the pool size set to 100. However, pooling can be disabled by setting the [UsePool](/componentone/api/services/online-dataconnector/dotnet-standard-api/C1.DataConnector/C1.DataConnector.C1ConnectionStringBuilder.UsePool.html) property to false.

The following code demonstrates the implementation of connection pooling in the ADO.NET provider for Kintone.

```csharp
// With Connection Pooling: It saves time by reusing existing connections from the pool
for (int i = 0; i < 1000; i++)
{
    C1KintoneConnection c = new C1KintoneConnection($@"{kintoneConnection};Use Pool=true;");
    c.Open();//Soft connections are build
    //Perform Your Operation  
    c.Close();//Connection is returned to the connection pool
}
```

The following example demonstrates how to disable connection pooling by setting the "Use Pool" property to false in the connection string.

```csharp
//Without Connection Pooling
for (int i = 0; i < 1000; i++)
{
    C1KintoneConnection c = new C1KintoneConnection($@"{kintoneConnection};Use Pool=false;"); //By default pooling is true
    c.Open();//A new connection is created each timed
    //Perform Your Operation  
    c.Close();//Connection object moved to garbage collection
}
```