Alex Lowe's .NET Blog

Taking feedback to the next level....

ADO.NET Tips....

Tim Sneath has some great ADO.NET Tips. Here are a few of my own:

  • Always close database connections. Yes, even in a GC world.
  • Always approach database connections as a limited resource. You should apply the concept of “acquire late, release early“. In other words, open the connection as late as possible and close it as early as possible. This is one concept that will help you and your application make use of connection pooling.
  • Use connection pooling whenever possible. Connection pooling is a built-in provided that all of the connections in your application make use of the same connection string. When I say “same connection string“, I mean exactly the same - even an extra space in a connection string will cause it to create its own pool.
  • Make use of the encryption libraries in the .NET Framework and encrypt your connection string. More info on this here.

 

Published Monday, August 25, 2003 9:49 AM by AlexLowe

Comments

 

DonXML said:

I've release a connection string encryption class on GotDotNet. You can find out more via my blog entry: http://weblogs.asp.net/donxml/posts/24923.aspx

or just go directly to the GDN sample: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=7d1d4954-a530-4329-8cc0-96a0c39ab4b2

DonXML
August 25, 2003 10:34 AM
 

Alex Lowe said:

Awesome, thanks Don!
August 25, 2003 10:55 AM
 

Travis said:

Does pooling work with SQL Authentification connection strings?
August 25, 2003 11:40 AM
 

Alex Lowe said:

Yes, I believe connection pooling will work with all types of authentication.
August 25, 2003 3:16 PM
 

Alex Lowe s NET Blog ADO NET Tips | Insomnia Cure said:

June 8, 2009 6:24 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker