Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Worst Practice - Bad Connection Strings and Bad Info in Sysprocesses


Worst Practice - Bad Connection Strings and Bad Info in Sysprocesses

Author
Message
Andy Warren
Andy Warren
SSCertifiable
SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)

Group: Moderators
Points: 7265 Visits: 2680
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/

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
brokenrulz
brokenrulz
SSC-Enthusiastic
SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)SSC-Enthusiastic (125 reputation)

Group: General Forum Members
Points: 125 Visits: 1
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
Nick-124591
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 2
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
Andy Warren
SSCertifiable
SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)SSCertifiable (7.3K reputation)

Group: Moderators
Points: 7265 Visits: 2680
Not that I know of. I'd suggest putting that question out as a separate topic, maybe someone else has tried to do it.

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Dan Collier
Dan Collier
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 16

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
John Scarborough
SSC Veteran
SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)SSC Veteran (292 reputation)

Group: General Forum Members
Points: 292 Visits: 52
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
Vadim Rapp
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 16
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search