Tracking the connection pool status in ADO. net

Source: Internet
Author: User
Because the test uses small data volumes, Program It runs normally, but when I got to the client and met more than 100 pieces of data, I was prompted that the connection had timed out, which left me puzzled. I don't know how to track it for a while.
Finally, I found a method to track the status of the data connection pool:
Http://www.yesky.com/SoftChannel/72342380484755456/20020930/1633376_2.shtml
By the way, copy it here:
Monitoring link pooling

You can useProfiler tool released by SQL ServerOr Performance Monitor released with Microsoft Windows 2000.

To use SQL Server Profiler to monitor link pooling, perform the following operations:

    1. ClickStart, PointingProgram, PointingMicrosoft SQL ServerAnd then clickProfilerRun profiler.

    2. InFileIn the menu, pointNewAnd then clickTracking.

    3. Provide the link content, and then clickOK.

    4. InTrace attributesIn the dialog box, clickEventLabel.

    5. InSelected event categoryList, make sure thatAudit LogonAndReview logoutThe event is displayed inSecurity ReviewBelow.

    6. ClickRunStart tracing. When the link is created, you will seeAudit LogonEvent. You can see it when the link is closed.Review logoutEvent.

To passPerformance MonitorMonitor link pooling as follows:

    1. Click Start, point to program, point to administrative tools, and then click performance Running Performance Monitor.

    2. Right-click the chart background and click Add counter.

    3. In the performance object drop-down list box, click SQL SERVER: General Statistics.

    4. In the displayed list, click the user link.

    5. Click Add, and then click Close.

note . the RTM version of the. NET Framework will also contain a set of ADO.. NET performance counters (these counters can be used together with performance monitors), which are used for SQL Server.. NET data provider monitors and accumulates the Connection Pooling status.
the number of connections increased from 1 to 100 when the program displays the DataGrid. Then keep the number of connections, and the connection timeout error occurs. The Code section is queried. It turns out that the data is dynamically read to display in the itemdatabound event of the DataGrid. The connection opened during data reading is not closed in time !!!
two lessons learned:
1. The connection must be closed in time. You can use the using syntax.
2. It is recommended that you do not dynamically execute the SELECT statement in the itemdatabound of the DataGrid, which will affect the display performance. It is best to use the left Outer Join method.

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.