8
votes

working with visual studio 2012 ultimate everytime i create a new dependency graph i get this error :

Unable to connect to the specified database.

An exception occurred attempting to connect to a database using the following connection string:
Data Source=(LocalDB)\v11.0;AttachDbFilename=;Initial Catalog=master;
Integrated Security=True;Enlist=False;
Asynchronous Processing=True;MultipleActiveResultSets=True;Connect Timeout=30.

Check that the specified SQL Server instance exists and the service is running.

my solution get build properly and my connection string is something like this :

<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=JewelryStore;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>

what is the problem here?

2

2 Answers

18
votes

Your issue is likely a problem with your localDB instance at:

%localappdata%\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

I had the same problem because when I installed VS12 my computer was not in a domain and I recently joined it to a domain and my user account does not have permissions to the SQL DB.
To fix the issue I ran

sqllocaldb stop "v11.0" -k
sqllocaldb delete "v11.0"
sqllocaldb create "v11.0" 
sqllocaldb start "v11.0"

I then restarted VS 2012 and my local DB is now usable and the Dependency Graph is now created

0
votes

After the suggested solution I still had the error. I had to execute Visual Studio as Administrator, this way solve the problem.