SQLOLEDB Connection Strings

This post is a little off track, but after spending quite some time trying to figure a technical problem out, I thought it might help out another lost soul, so I’m posting under Technical Architecture.

If you need to use an OLE style connection string to connect to a SQL Server database (for example, you’re using pre-written code that relies on that provider type), but you’re having trouble connecting, you can use the SQL Native Client Provider instead.

So rather than:

Provider=SQLOLEDB;Server=myhost;Database=mydatabase;Persist Security Info=False;User ID=xxxx;Password=yyyy

you can use:

Provider=SQLNCLI;Server=myhost;Database=mydatabase;Persist Security Info=False;User ID=xxxx;Password=yyyy

Bear in mind, the provider should match your version of Native Client, so in my case (I’m running SQL Server 2008 R2), it’s actually SQLNCLI10, as per:

http://msdn.microsoft.com/en-us/library/ms130822.aspx

If you can, avoid SQLOLEDB altogether and use SQLClient.

Hope that helps someone.


Warning: Illegal string offset 'echo' in /var/www/html/wp-great-seo/wp-content/themes/social/library/extensions/custom-field-series.php on line 79

2 Comments

  1. Jeff

    Perfect, thanks. Do you use any other MS products? My company used Microsoft applications until about 2006 and then moven to Apple. It took a lot to (2 years!) to get 100% and function to everyone’s needs but now it’s untouchable. Saved hundreds on licensing! Thanks, Jeff.

    1. Sam Langdon

      Very interesting to hear your experiences. My employer is pretty much entirely MS from an infrastructure/server point of view. Windows is pricey for OS licenses et al, but then Apple aren’t cheap for the hardware. Either way, we have hundreds of .Net based websites & applications running on Windows/IIS, so think it would take us a lot longer than 2 years to switch if we wanted to. This website is something I do in my spare time (hence I don’t post very often :o)) and is running on a Windows server in my loft at home, with an OS license kindly donated from a friend’s MSDN subscription!

Leave a Reply to Jeff

Click here to cancel reply.