How to: Enable Multi-tier Debugging

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional

Visual Studio Express

ms165060.DoesApplybmp(en-us,VS.100).gif ms165060.DoesApplybmp(en-us,VS.100).gif ms165060.DoesApplybmp(en-us,VS.100).gif ms165060.DoesNotApplybmp(en-us,VS.100).gif

The following procedure describes how to enable multi-tier debugging for an instance of SQL Server, beginning with SQL Server 2005. These steps are not needed if you are only debugging on the database tier.

When you specify multi-tier debugging, you are specifying the credentials to use for connecting to databases from application code. Server Explorer may contain multiple data connections to the same instance of SQL Server. These data connections may correspond to different databases, or to different credentials for the same database. Examples of different credentials include:

  • Windows Authentication-based SQL Server login IDs.

  • SQL Server Authentication-based SQL Server login IDs.

To initialize an instance of SQL Server for multi-tier debugging, you choose one of those credentials by choosing the corresponding data connection in Server Explorer. When you enable multi-tier debugging for one data connection, the entire database server is enabled for debugging. If you enable multi-tier debugging on a connection that uses Windows Authentication, the credentials associated with the connection restrict which databases you can debug.

If no connection has been enabled for multi-tier debugging, or if the credentials are not sufficient for debugging, breakpoints set in Transact-SQL objects on the corresponding server will not be hit.

Setting a breakpoint in a Transact-SQL database object automatically enables the server for multi-tier application debugging, if it is possible. Enabling the server for multi-tier debugging may not be possible if you do not have a connection with Windows Authentication.

To successfully debug multi-tier applications, you must have enabled debugging for the application project. For more information, see How to: Enable Transact-SQL Debugging For a C++, Visual Basic, or C# Project.

After you have started debugging, it is too late to change settings in Server Explorer. Changes made in Server Explorer will not take effect until the start of the next debugging session.

Note

If you have connection pooling enabled, you must temporarily disable it while debugging. For more information, see Transact-SQL Debugging Limitations.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To enable multi-tier debugging

  1. Enable Application Debugging for the data connection in Server Explorer corresponding to your application code (written in C++, Visual Basic, or C#, etc.).

    1. Open Server Explorer.

    2. Click a database connection, under the Data Connections node, to select it.

    3. Right-click the connection you want to debug, and on the shortcut menu, click Application Debugging.

  2. Enable SQL Server debugging in the properties of your application project by selecting Enable SQL Server debugging. For more information, see How to: Enable Transact-SQL Debugging For a C++, Visual Basic, or C# Project

See Also

Other Resources

Setting Up Transact-SQL Debugging