Extended Events - Capture connection string used to connect to SQL

Mark Gordon 901 Reputation points

Fellow SQLers,

I am trying to see if I can capture the actual connection string used when a user connects to SQL.

I know I can capture their options (Set ….. etc) but cannot find an event that give me the actual connection string.

Is it doable with Ext Events?



SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,324 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Phillips 17,711 Reputation points

    That data does not exist in SQL Server. The connection string is how the caller connects to SQL Server.

    What exactly are you looking for?

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 99,626 Reputation points MVP

    As Tom says, this is not possible. The connection server is the client's business, and not SQL Servers. You can deduce some of the contents down in SQL Server, for instance by looking at functions such APP_NAME() or HOST_NAME(). But things like passwords, connection timeout, or configuration of the connection pool never makes it to SQL Server.

    1 person found this answer helpful.
    0 comments No comments

  2. Mark Gordon 901 Reputation points

    Thanks Guys.
    I can take it from here.

    0 comments No comments