Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's causing "The specified LocalDB version is not available on this computer" error on SQL LocalDB?

I have just done a clean installation of VS2015 Update 2 on a new workstation and have set about running some of our integration tests that used SQL LocalDb. They are failing with the following SqlException:

Additional information: Local Database Runtime: Cannot create named instance.

The specified LocalDB version is not available on this computer.

The connection string we are using is (and was previously working with VS2013):

server=(localdb)\SystemTest;Integrated Security=true

As you can see, this does not specify any version, and is actually trying to connect to a named instance.

If I run sqllocaldb v I get:

Microsoft SQL Server 2014 (12.0.2000.8)
Microsoft SQL Server 2016 Release Candidate 0 (RC0) (13.0.1100.286)

I have tried creating and starting the 'SystemTest' instance by hand, even specifying the versions, but both seem to result in the same SqlException being thrown.

Has the connection string syntax changed? What am I missing?

Update: If I use the automatic instance (now named 'MSSQLLocalDb' on SQL2014 and above) the code works just fine. When comparing the two instances with sqllocaldb i they are both identical except one is Auto-create. They are both in the Running state. So it appears the problem is only occurring with named instances.

like image 403
Jack Ukleja Avatar asked Oct 18 '22 11:10

Jack Ukleja


1 Answers

I found the problem. I had forgotten that I was using localdb configuration section to automatically create named instances. Here I was specifying a version, and because v11.0 is no longer installed with VS2015 I get the exception.

  <system.data.localdb>
    <localdbinstances>
      <add name="SystemTest" version="11.0" />
    </localdbinstances>
  </system.data.localdb>
like image 184
Jack Ukleja Avatar answered Oct 21 '22 05:10

Jack Ukleja