SQL连接字符串的最大数目 [英] maximum numbare of SQL connection strings

查看:86
本文介绍了SQL连接字符串的最大数目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我正在使用sql server 2005编写c#.net ASP Web应用程序.我需要知道打开它后是否没有关闭连接字符串..使用该Web应用程序可以连接到db的计算机的最大数量是多少. .

解决方案

如果我正确理解,您正在询问使用conn.Open()打开的连接数.好吧,这就是Conneciton Pooling.这是开"中的默认设置.
每当conn.Open(); 执行时,它将创建一个连接池.
作为良好的编码习惯和标准,您应该始终关闭连接.否则,经过一段时间后,您将收到错误消息,例如 Error on maximum number of connections exceeded connection pool has reached maximum number of connections.您也可以在配置文件中配置连接池限制.
但是,作为一种好习惯,请始终使用适当的connec tion open / close.


为什么不正确地编写代码以免发生这种情况?


hi
i am writing c#.net ASP web application using sql server 2005. I need to know if i didn''t close the connection string after open it .. what is the maximum number of computer can connect to db using that web application ...

解决方案

If I understood properly, you are asking about number of connection that you are opening using conn.Open(). Well this is know as Conneciton Pooling. Which is Default in On.
whenever conn.Open(); executes, it will create a Connection Pool.
As a good coding practice and standards, you shuld always close the connection. Other wise, after certain period of time you will get error message like Error on maximum number of connections exceeded or connection pool has reached maximum number of connections. You can also configure connection pool limit in your config file as well.
But, as a good practice, always use proper connection open / close.


Why not just write your code properly so that this does not happen ?


这篇关于SQL连接字符串的最大数目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆