How to resolve SqlConnection error “Keyword not supported: 'decr pool size'.”
I am creating Windows Application and using System.Data.SqlClient.SqlConnection object
SqlConnection targetDatabaseConnection = new SqlConnection(ConnectionString);
Following is the connection string
Data Source=.;Initial Catalog=TestBCP_12;User ID=sa;Password=sa;Min Pool Size=100; Max Pool Size=100; Decr Pool Size=100; Incr Pool Size=100;
Getting error with the following two settings
Decr Pool Size=100; Incr Pool Size=100;
I know all the sizes are 100 , is it the cause of exception if yes? , the message is not reverent to the error .
I read the following article and implemented based on it
Found the answer that this is not possible in SQL directly so asked new question
How to achieve functionlity i.e. controlling "Incr Pool Size" or "Decr Pool Size" while establishing connection to SQL? similar to ORACLE
to find other possible ways to achieve it.
3 Solutions collect form web for “How to resolve SqlConnection error “Keyword not supported: 'decr pool size'.””
Since you are using SqlConnection, it does not support
Decr Pool Size or
Incr Pool Size. This property is supported with OracleConnection
You may check this article: Connection Pooling in DotNet
From the article:
You should refer to the documentation if you’re using a .NET Data
Provider other than SQL Server. Other data providers may have more
pooling options. A good example is the Oracle Data Provider, which
offers two options — Decr Pool Size and Incr Pool Size — for
controlling how a connection pool may shrink or grow.
The list of accepted keywords is documented on MSDN. Neither
Decr Pool Size nor
Incr Pool Size are listed there.
You Are using a syntax for Oracle connection strings against a SqlServer database.
DECR POOL SIZE and
INCR POOL SIZE are not supported in SqlServer connections.
Simply remove these two parts from your connection.
Also I suggest to remove the
Max Pool Size=100; since this is the default value.
Min Pool Size=100; could also be removed if there is no special requirement to have an initial minimum size