I'm trying to connect to a SQL Server LocalDB instance using the SQL Server Native Client driver. This is because we are looking to use Native Client in our production environment to gain access to the use of subject alternative names on SSL encryption for SQL Server. So far I'm not having much luck - is this a supported scenario? My connection string is:
<add name="Database" connectionString="Driver={SQL Server Native Client};Server=(localdb)\v11.0;Integrated Security=True;AttachDBFileName=|DataDirectory|Database.mdf;" providerName="System.Data.Odbc" />
The error I'm receiving is:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Any thoughts on how to connect?
You need to use a version of the Native Client that supports LocalDB. You're using version 9. Try:
Driver={SQL Server Native Client 11.0}
Microsoft called this out a long time ago:
Note that because the activation logic lives in the client-side provider, you need to install the latest one - SQL Server Native Client "Denali" (for ODBC and OLE DB) or the next .NET Framework (for ADO.NET).