Worst Practice - Bad Connection Strings and Bad Info in Sysprocesses

  • Can you do this with VBScript in asp pages as it seems to reflect good practice!

  • Sure. Pretty common to include the requesting IP address to make it more helpful.



  • Good idea! I am on the start point of the big databse project now and this will for sure save my time and will save me from a headache.

    Thank you.

    P.S. Where is possible to read about what parameters can we put into connection string? Because before I've read this article I had no idea about application name and some other parameters.

    To change the world find its source code...

  • * BLUSH * Big Time!

    This is ripe coming from a DBA who still develops, but I'd often looked at the sysprocesses and wondered whether I could get the additional information to appear there - a severe case of RTFM!! Guilty as charged m'lud!

    Isn't is amazing how quickly I can now respond right down to the desk when there are problems by identifying the precise user causing locks and slow processes within seconds. Eveyone will soon think I'm spying on them (more than I do now anyway).

    Great artice, and an example of how a small change can make a huge impact.

    It is by caffeine alone I set my mind in motion.
    It is by the Beans of Java that thoughts acquire speed,
    the hands acquire shaking, the shaking becomes a warning.
    It is by caffeine alone I set my mind in motion.

  • Good article Andy. My apps use common code for connection strings so adding this would be easy for me. As I do not have a large user base for my apps I track usage by workstation ID/database and a quick phone call usally identifies what the user is doing. Must admit though I have been using the app/page name addition in asp for some years (not to steal your thunder though!) and makes diagnosing easy but as already stated it will increase your connections from web server even with connection pooling.

    BTW I did read somewhere (can't remmeber where) that there were problems with switching on connection pooling with the later versions of MDAC which cause connection failure and network errors.

    Edited by - davidburrows on 08/01/2003 02:25:48 AM

    Far away is close at hand in the images of elsewhere.

  • My only complaint is that I needed you to write this article about a year ago!

    Oh well, such is life.

  • I've always used the very minimum connection string in my applications, but I ran into the exact problem Andy was talking about -- I had an older version running and had to find it by trial and error. I will definitely be putting the extra info in all my future projects.

    Joe Johnson

    Joe Johnson

  • I've always given thought on how this could be done, but never followed through. This is definately going into our best practices documentation!

    Are there any other nifty things (clues) that can be added to the connection string that would show up in sysprocesses?

    Brian McCool

  • Hi there,

    the following came right in


    Thought I'd share it



    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Not that I've thought of, but you could really stick any bit of data there that might help you troubleshoot. MDAC version? Client OS? Though you could log that stuff elsewhere, if something like that helps you run down a problem, try it.



  • Having often filled the role of developer in an organization, I find it somewhat offensive that you claim someone is a victim of a "baaaaad developer." If an organization is sophisticated enough to have a dba who monitors database activity from multiple applications, that organization should also have a clearly defined process around how to connect to their databases.

    Requirements of a project should include such information. The developer implements what is asked in those requirements.

  • Not trying to be offensive, though I think its semi-accepted practice for DBA's to complain about developers and vice versa. I'd like to think you're right that in large shops this would be part of the ground rules, not so sure. In any case, my hope is to get people to add it to their base requirements even if they are a 1-2 developer operation.



  • Not coming from a VB development shop, we use strictly Delphi, I am not familiar with defing the connection like that. You can do it Delphi but there is no reason to. I have noticed however when our research department pulls data into Access.

    This has never been a issue for us as we have several .udl files on our file server that the application reads it's connection info from at startup. This allows us to switch SQL Servers rapidly. If one server went down all I have to do is switch the connection properties in the .udl file and everyone is then using a backup server. This came in handy when we upgraded our server this spring.


  • UDL's are ok, as are DSN's for that matter, both exist to let you easily edit connection strings. The downside is that they aren't secure if you're using a sql login/password. But that is another discussion!



  • Very helpful article. I may have missed this in the thread, but I'm wondering if there's a way to get the workstation id from within an MS Access app?


Viewing 15 posts - 16 through 30 (of 36 total)

You must be logged in to reply to this topic. Login to reply