From dc97d5ce542c4502f207f68cf30286f5ad1f6cc9 Mon Sep 17 00:00:00 2001 From: syneffort Date: Fri, 30 Sep 2022 11:28:39 +0900 Subject: [PATCH] connection pooling --- MainApp/MainApp/AdoClient.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MainApp/MainApp/AdoClient.cs b/MainApp/MainApp/AdoClient.cs index 9fa07d4..c05d239 100644 --- a/MainApp/MainApp/AdoClient.cs +++ b/MainApp/MainApp/AdoClient.cs @@ -14,11 +14,14 @@ namespace MainApp private string connString; private SqlConnection conn; - + + private const int MIN_POOL_SIZE = 20; + private const int MAX_POOL_SIZE = 100; + private const int TIMEOUT = 15; // sec public bool SetConnection(string server, string database, string uid, string password) { - connString = $"server={server}; database={database}; uid={uid}; pwd={password};"; + connString = $"server={server}; database={database}; uid={uid}; pwd={password}; min pool size = {MIN_POOL_SIZE}; max pool size = {MAX_POOL_SIZE}; connection timeout = {TIMEOUT};"; using (conn = new SqlConnection(connString)) {