Extended Events - Capture connection string used to connect to SQL

Mark Gordon 641 Reputation points
2020-09-21T17:24:10.133+00:00

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?

Thx

MG

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

Accepted answer
  1. Tom Phillips 17,511 Reputation points
    2020-09-21T18:28:37.2+00:00

    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?

    No comments

2 additional answers

Sort by: Most helpful
  1. Erland Sommarskog 67,821 Reputation points Microsoft MVP
    2020-09-21T21:36:58.027+00:00

    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.

    No comments

  2. Mark Gordon 641 Reputation points
    2020-09-22T16:16:52.04+00:00

    Thanks Guys.
    I can take it from here.
    mg

    No comments