1.21. Monitoring Connections
Problem
You want to monitor the opening and closing of connections and the number of connections in the connection pool while an application is running.
Solution
Use the Windows Performance Monitor and the SQL Profiler to monitor connections and connection pooling. See Recipe 1.17 for more information on connection pooling.
Discussion
The following subsections discuss monitoring connection pooling for SQL Server and ODBC .NET Framework data providers.
SQL Server
You can monitor SQL Server connections and connection pooling using the SQL Server Profiler or the Windows Performance Monitor as described in the following subsections.
SQL Server Profiler. To use the SQL Server Profiler to monitor connection pooling:
Start the Profiler using one of the following methods:
From Windows desktop: Start → All Programs → Microsoft SQL Server → Performance Tools → SQL Server Profiler.
From SQL Server Management Studio: Tools → SQL Server Profiler.
When the SQL Server Profiler appears, select File → New Trace.
Supply connection details and click Connect. The Trace Properties dialog box will appear.
Select the Events Selection tab of the Trace Properties dialog box.
In the Selected Events list box, ensure that the
Audit LoginandAudit Logoutevents appear beneath the Security Audit node. Remove all other events from the list. Click the Run button to start the trace.The new Profiler window will display a table containing
Audit Loginevents when connections are established andAudit ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access