5

I have installed Sql Express 2012 version. I installed Local Db separately. i can see its installed when I click on "Installed Sql Server discovery report". However, I cannot connect to it using Sql Server Management Studio or Microsoft Visual Studio 2012 Professional Edition. I get the error:

"The attempt to attach to the database failed with the following information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details."

In Windows Event viewer I see several of following errors with different regsistry keys each time:

"The DataDirectory registry value is missing in the LocalDb instance registry key:{-----}"

I checked in regsitry values for local db in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSQL Server Local DB and there's only one entry "Installed Version". I have gone through several posts which state solution for the above error and have done almost everything they have suggested but still can't get localDb to work.

I'd appreciate any help that one can provide in order to solve this issue.

UPDATE:

Using Command Line Interface I verified that localDb v11.0 is installed. However, the command sqlLocalDb info v11.0 gives error:"The automatic instance "v11.0" is not created. If I try to create one it gives another error:"Unexpected error occured inside a localDb instance API method call."

wildplasser
  • 43,142
  • 8
  • 66
  • 109
AM0
  • 165
  • 2
  • 4
  • 20

2 Answers2

0

You may try to use SQL Server Authentication. Also make sure that your SQL service is running.

Also you may try to delete the following registry:

HKEY_USERS\.DEFAULT\Software\Microsoft\Microsoft SQL Server\UserInstances\[GUID_FROM_EVENT_LOG]

You may also check Getting Started with SQL Server 2012 Express LocalDB

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • Yes, SQL Server is running. – AM0 Dec 10 '13 at 18:32
  • There is no entry for Microsoft SQL Server in HKEY_USERS\.DEFAULT\Software\Microsoft. I can also see Sql Server Management Studio over there. – AM0 Dec 10 '13 at 18:32
  • @user3088008:- Please check the link which I have added in my answer! – Rahul Tripathi Dec 10 '13 at 18:33
  • Also check this: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/0628296e-939a-4700-b498-1c3c9ce90597/a-networkrelated-or-instancespecific-error-occurred-while-establishing-a-connection-to-sql-server?forum=sqlsecurity – Rahul Tripathi Dec 10 '13 at 18:36
  • I created a LOCALDB instance in SqlLocalDb. I can connect to it in Management Studio but still not to LocalDb\\v11.0. Although I can see that v11.0 is an instance in SqlLocalDb. – AM0 Dec 10 '13 at 19:46
  • I have installed 64 bit version of SQL Express 2012. And I have VS 2012 Pro. This issue is with VS 2008 and Sql Server 2008. But looks similar to my problem: http://blogs.msdn.com/b/sqlexpress/archive/2008/10/02/faq-error-creating-a-service-based-database-in-visual-studio-2008-sp1.aspx – AM0 Dec 10 '13 at 19:57
  • I too had this issue, and was due to multiple versions of the localDB. But there is a default instance available .. please follow the link http://stackoverflow.com/a/31383366/1662459 – G J Jul 15 '15 at 06:41
  • Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Services, and check if SQL Server service status is “Running”. and Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP set enabled – Singh Kailash Mar 01 '17 at 09:11
0

You need to start the SQL service for the local system.

  1. Start Button
  2. Write "SQL Server Configuration Manager" and click on it
  3. After opening "SQL Server Configuration Manager" you need to start the local system services which are may be stopped in it that why your local Database not connected.

After starting local services you just connect the local system database. It should connected successfully.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92