Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4599914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:36:34+00:00 2026-05-21T23:36:34+00:00

To explain the need further, consider this scenario: In a legacy system that relies

  • 0

To explain the need further, consider this scenario:

In a legacy system that relies heavily on TRIGGERS, we need to provide a token of some sort (let’s call it “SessionID”) to be inserted into some security log tables. This token is created in C# in the application server, and will be passed into all SQL commands.

SADLY, THIS REQUIREMENT ON TRIGGERS IS UNCHANGEABLE

So, because I have access to modify the connection string, I can (and have successfully proven that I can) use the “Application Name” token to provide this piece of information.

string connectionString = string.Format("SERVER=sql.example.com; "
    + "DATABASE=someDB; User ID=xyz; Password=123; Application Name={0}", sID);

Since this works, what’s the problem?

The problem is very simple… the above works, but since we have thousands of users… our connection-pool is destroyed (since connection pools are made based on the connection string… basically, I need the connection pool to be based on everything except the Application Name property).

So, do you know of how I can either:

  1. Set a property in the connection string that will NOT be included in pooling.
  2. Set a contextual property for this connection some other way that is not incredibly heavy on performance.

As a side-note… I could open the connection right away and create a temp table with a single value:

SELECT 12345 AS SessionID INTO #context

But that seems incredibly overkill!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T23:36:34+00:00Added an answer on May 21, 2026 at 11:36 pm

    You would need to execute this rather than rely on the connection string, but rather than a temp table SET CONTEXT_INFO / CONTEXT_INFO()can be used to associate some arbitrary data against the current session/connection (and is available in triggers).

    If its acceptable for the server to create the variable from some combination of user/time etc you could assign CONTEXT_INFO automatically from within a logon trigger, in which case you would not need to change your connection mechanic at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to explain this by example: Is there a best practice or preference
It would take too long to explain why I need this, but I was
This is a general question, but I'll explain my specific need at the moment:
I need the internal implementation of HashTable in java code. Further can you explain
To further explain my situation. I know that when you're using dynamic libraries, you
OK, let me see if I can explain. I have some code that wraps
I need to clear a basic concept. This code works fine. Can somebody explain
i will explain the best i can if u need further explanation or detail
Let me explain: I need to sort a list in ascending order, while results
I need to explain myself why I do not use static methods/propertis. For example,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.