是否应在数据库连接字符串中设置最大池大小?如果我不这样做会怎样? [英] Should I set max pool size in database connection string? What happens if I don't?
问题描述
这是我的数据库连接字符串。直到现在我还没有设置最大池大小。
This is my database connection string. I did not set max pool size until now.
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;";
目前我的应用程序支持多少个连接?增大连接池大小的正确语法是什么?
So currently how many connections does my application support? What is the correct syntax for increasing the connection pool size?
应用程序是用C#4.0编写的。
The application is written in C# 4.0.
推荐答案
当前,您的应用程序在池中支持100个连接。如果要将其增加到200,则conn字符串将如下所示:
Currently your application support 100 connections in pool. Here is what conn string will look like if you want to increase it to 200:
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;Max Pool Size=200;";
您可以通过执行 sp_who来调查应用程序使用了多少个数据库连接
过程。在大多数情况下,默认的连接池大小就足够了。
You can investigate how many connections with database your application use, by executing sp_who
procedure in your database. In most cases default connection pool size will be enough.
这篇关于是否应在数据库连接字符串中设置最大池大小?如果我不这样做会怎样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!