Worst Practice - Bad Connection Strings and Bad Info in Sysprocesses

  • Andy Warren

    SSC Guru

    Points: 119676

    I think Access/VBA supports Environ$ - if so calling Environ$("computername") should work. Type set at a command prompt to see all variables accessible using this method. If not, you can always get it with an API call, which I'd have to dig around for.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • brokenrulz

    SSCrazy

    Points: 2261

    One thing I would like to contribute is regarding the connection string. Although it is true that opening database connections is one of the time consuming operations and connection pooling helps reducing it(if connection strings are exactly the same).

    However I am not sure how connection pooling will be implemented in typical 2 tier applications,Yes as far a I know connection pooling is one of the services used by MTS in 3 tier architecture and also IIS uses it.

    SO I presume that the suggestions provided in the article would hold true for 2 tier applications. If any one can has tested the same on 3 tier architectures and found any performance degradtion can share their comments..

    Relationships are like Banks.You Invest the Principal and then get the Interest.


    He who knows others is learned but the wise one is one who knows himself.

  • Nick-124591

    Valued Member

    Points: 57

    Nice enhancement. I have several components that are running and I would like for the same connection change the 'Application Name'. It seems that this is a read only parameter. Do you know by any chance if there is a way to change the application name or another property that could be used so that can be set when the query is done while maintaining the same connection?

  • Andy Warren

    SSC Guru

    Points: 119676

    Not that I know of. I'd suggest putting that question out as a separate topic, maybe someone else has tried to do it.

  • Dan Collier

    SSC-Addicted

    Points: 473

    Yes, good article, Connection strings well written saves lots of time when maintaining an Application.

    This is very good. I have used this method in the past when we had to to do rapid re-deploys and talk about a time saver.

  • John Scarborough

    Ten Centuries

    Points: 1104

    It's funny and everything to use the phrase "baaad developer", but the problem is, I have to edit the article to show it to the developers.  I'm not sure this sort of contention is a good thing anyway... 

    John Scarborough
    MCDBA, MCSA

  • Vadim Rapp

    SSC Veteran

    Points: 239

    In case of the client using Microsoft Access, the baaad developer is actually Microsoft. Access Project purposely puts developer's machine name into the connection string when it connects to the server. I have been reporting this to Microsoft probably already for ten years in beta programs of both Office and SQL Server, but with Microsoft beta programs being nothing but marketing campaigns, it was of course to no avail. Eventually, I had to write small application that performs binary patch of the compiled Access database and erases the machine name right from the file.

    And I'm pretty sure that Access is not the only application that does it. I bet Excel/Query Designer does the same.

Viewing 7 posts - 31 through 37 (of 37 total)

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