Notes from Daily Encounters with Technology RSS 2.0
 
# Sunday, March 25, 2007

In Windows Vista the default value for the Persist Security Info parameter of an ADO connection string has changed from True to False.

You should be aware of this because it can prevent your legacy code from working properly under Windows Vista. If its value is set to False the Server, Database, Trusted_Connection and Password parameters will be removed from the ConnectionString property of the Connection object once the connection has been opened. If you’re creating new connections by just copying the ConnectionString property from an existing and already opened connection to the new one, your code will break under Vista.

The problem can easily be fixed by explicitly setting Persist Security Info to True in your original connection string but it should be mentioned that this can be a potential security risk if untrusted code gets access to your Connection object. Even more so in case you’re not using integrated security and the connection string actually contains the user’s password for accessing the database. It’s a much better practice to have the actual connection string stored separately and use it directly to create new connections.

On a side note, SqlClient in ADO.NET works much more consistently. The Persist Security Info parameter always defaults to False. It also only removes the Password parameter from the ConnectionString property which makes changing its value to True completely unnecessary unless you really feel a strong urge to share your user’s password.

Sunday, March 25, 2007 9:48:05 AM (Central European Daylight Time, UTC+02:00)  #    Comments [2] - Trackback
Development | VB6
Tuesday, February 26, 2008 12:44:52 PM (Central European Standard Time, UTC+01:00)
Hi Darmir.
I have add the "persist security info=True", but the problem still remain.
My connection string it is:
Provider=SQLNCLI.1;Persist Security Info=True;User Id=sa;Data Source=Server\Db;Use Procedure for Prepare=1;Auto Translate =True;Packet Size=4096;Workstation Id=xxxxx;Use Encryption for Data=False;Tag with column collation when possible=False;MARS Connection=False;DataTypeCompatibility=0;Trust Server Certificate=False;;

I use a sql server 2005 express edition database.
Any idea?
Ciao
Dedalus
Wednesday, March 26, 2008 6:08:15 PM (Central European Standard Time, UTC+01:00)
Hi Darmir:

That fixed worked great for me for connection to a sql server db, thanks! However, the application I support also interacts with MS Access dbs, and the same Vista problem seems to be affecting the ado connection. If I add "persist security info=True" to the connection string or set the connection.properties("persist security info=True") to true, it still isn't working, and the connection's connection string doesn't keep that property. Any idea what I need to do to fix this?

Thanks,
Mark
Mark
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Sponsored Ads

About Me

Damir Arh

Microsoft Certified Professional

View Damir Arh's profile on LinkedIn

Profile for ExAmigan

ExAmigan

Twitter
Damir's Corner: Avoiding Queue Starvation in CruiseControl.NET http://goo.gl/fb/G52YB 1 day ago
RT @aleksj: From http://last.fm/robots.txt: Disallow: /harming/humans, Disallow: /ignoring/human/orders, Disallow: /harm/to/self #asimov 2 days ago
Eagle Eye on DVD was a pleasant surprise. It passed under my radar when it was first released. 5 days ago
Multiple RTM gadgets in iGoogle suddenly can't show different lists anymore http://digs.by/aD5AbJ 6 days ago
Notifications for new projects in CCTray are a nice new feature of #ccnet 1.5 7 days ago
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

All Content © 2010, Damir Arh, M. Sc. Send mail to the author(s) - Privacy Policy - Sign In
Based on DasBlog theme 'Business' created by Christoph De Baene (delarou)