SQL Server handles connection pooling issues

Source: Internet
Author: User
Tags connection pooling

When a site is linked to a database with a large number of users, if the previous connection does not commit a transaction, it is possible that the next connection will experience a failure to access the database because the last connected transaction did not commit. Microsoft's SQL Server Client programming interface: The mechanism of connection pooling is supported by ADO and ADO. The error message may be "All connection pools are in use and the maximum pool size is reached".

Workaround:

1. If it is ODBC, it can be changed manually in ODBC. Select "Pool connetions to this drive" (connect to the driver using the pool) and change the time below to a larger point.

2. If the shared connection is SqlConnection, specify a value for the ConnectionString property connection lifetime numeric name, which by default is 0, indicating that the connection will never be automatically moved from the pool. If a different value is specified, once the connection is returned to the pool, the value is compared to the time the connection was created and the current time. If the lifetime exceeds the value of connection lifetime, then the connection is removed from the pool. Add the following code after the connection string: enlist=true; Pooling=true; Max Pool size=300; Min Pool size=0; Connection Lifetime=300;user id=sa;packet size=1000 Packet The size parameter takes any integer value from 512 to 32767.

3, DataReader is exclusive connection, when the number of links exceeds the maximum limit of DataReader, there will be problems.

SQL Server handles connection pooling issues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.