none
Can't Connect to LocalDB

    Question

  • I can't connect to LocalDB using Visual Studio for Web Express 2012 or SMSS 2012 in a Windows 8 environment. LocalDB is installed and some things do work, however. The basic error is the very common:

    Cannot connect to (LocalDB)\v11.0.

    ------------------------------
    ADDITIONAL 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. Error occurred during LocalDB instance startup: SQL Server process failed to start.

    ------------------------------

    In a command window, I can query the state of LocalDB an "info" parameter:

    C:\Program Files\Microsoft SQL Server\110\Tools\Binn>sqlLocalDB info
    SportsStore
    TestOfLoc
    v11.0

    The first two are tests created at the command line using sqlLocalDB.

    I have reinstalled and repaired LocalDB several times with no errors reported.

    As a further demonstration of the problem, I've included the login screen error.

    Sunday, January 27, 2013 12:33 AM

Answers

  • Just to complete the picture ... I ended up completely reinstalling Windows 8 and Visual Studio 2012 Express. That solved the problem. I can access LocalDB now.

    • Marked as answer by Seigfried Monday, January 28, 2013 5:55 AM
    Monday, January 28, 2013 5:55 AM

All replies

  • Hi Seigfried,

    When connecting from Management Studio, be sure to connect to the instance using the following format:
    (localdb)\MyInstance
     
    If you are connecting to a shared instance, where you are not the owner, use:
    (localdb)\.\OurInstance

    SQL Server 2012 Express LocalDB: http://msdn.microsoft.com/en-us/library/hh510202(v=SQL.110).aspx.

    Troubleshoot SQL Server 2012 Express LocalDB (en-US): http://social.technet.microsoft.com/wiki/contents/articles/4609.troubleshoot-sql-server-2012-express-localdb-en-us.aspx.

    If you have any feedback on our support, please click here.

    Thanks.


    Maggie Luo
    TechNet Community Support

    Sunday, January 27, 2013 5:33 PM
    Moderator
  • Didn't work.

    The problem is not that the instance can't be found. The problem is that the process for LocalDB won't start. I've spent hours ... actually days ... trying to track this down. Most recently, I have completely uninstalled SMSS, SQL Server 2012 and Visual Studio Express 2012 and then completely reinstalled them. (No errors were noted in any of this.)

    As noted, I can create, start, stop, and delete instances of databases from the command line using sqlLocalDB.

    Sunday, January 27, 2013 7:53 PM
  • Just to complete the picture ... I ended up completely reinstalling Windows 8 and Visual Studio 2012 Express. That solved the problem. I can access LocalDB now.

    • Marked as answer by Seigfried Monday, January 28, 2013 5:55 AM
    Monday, January 28, 2013 5:55 AM
  • I started having this problem too, and before i resorted to reinstalling windows, vs2012 and sql2012, i checked out the link Maggie posted above and fixed it.  Specifically, i opened up the Command window (run -> cmd) and typed:

    sqllocaldb create "v11.0"

    and it returned the message

    "Creation of LocalDB instance "v11.0" with version 11.0 failed because of the following error:
    LocalDB instance is corrupted. See the Windows Application event log for event details."

    So then i deleted it and recreated it and now i can login. Maybe this will help the next person:

    c:\sqllocaldb delete "v11.0"
    LocalDB instance "v11.0" deleted.

    c:\sqllocaldb create "v11.0"
    LocalDB instance "v11.0" created with version 11.0

    Cheers,
    Carlos


    • Edited by losbear Sunday, April 21, 2013 8:14 PM
    • Proposed as answer by zibmak Sunday, May 19, 2013 5:22 AM
    Sunday, April 21, 2013 8:14 PM
  • Yes this Deleting and Creating the instance was worked for me.

    when creating instance start instance option is good for immediate connection with SQL Server Managment Studio 2012

    c:\sqllocaldb delete "v11.0"
    LocalDB instance "v11.0" deleted.

    c:\sqllocaldb create "v11.0" -s
    LocalDB instance "v11.0" created with version 11.0.
    LocalDB instance "v11.0" started.

    Now SSMS connetion to (localDB)\v11.0 ok.

    THANKS to Carlos and losbear

               

    Avatar of losbear                                                   

    losbear

    Lionbridge

    15 Points                1                0                0                       
    Recent Achievements           
    First Forums Reply                                                           
    losbear's threads                                View Profile           

    • Proposed as answer by moh_addeeb Sunday, August 31, 2014 8:27 PM
    Sunday, November 17, 2013 4:20 PM
  • I started having this problem too, and before i resorted to reinstalling windows, vs2012 and sql2012, i checked out the link Maggie posted above and fixed it.  Specifically, i opened up the Command window (run -> cmd) and typed:

    sqllocaldb create "v11.0"

    and it returned the message

    "Creation of LocalDB instance "v11.0" with version 11.0 failed because of the following error:
    LocalDB instance is corrupted. See the Windows Application event log for event details."

    So then i deleted it and recreated it and now i can login. Maybe this will help the next person:

    c:\sqllocaldb delete "v11.0"
    LocalDB instance "v11.0" deleted.

    c:\sqllocaldb create "v11.0"
    LocalDB instance "v11.0" created with version 11.0

    Cheers,
    Carlos


    I uninstalled localdb and deleted the instances in app data\local, reinstalled. Then I could not run localdb. I had to do the delete and create as shown in the quoted post. There are issues with localdb install/uninstall, but reinstalling windows is ridiculous.

    • Proposed as answer by P a u l Tuesday, June 3, 2014 9:36 PM
    Tuesday, June 3, 2014 6:41 PM
  • This error has nothing to do with reinstalling software. 

    Sqlservr.exe is being denied and cannot write to the instance folder. Check this MSDN solution - http://bit.ly/1s5Vv7H
    You can determine good startup behavior from Sqlservr.exe by checking the instance folder. - You should see normal log files plus a few other SQL Server dump files.




    • Edited by Greg_mtc Thursday, June 12, 2014 3:15 PM
    Thursday, June 12, 2014 3:13 PM
  • This worked for me. Thanks Carlos!
    Tuesday, July 14, 2015 3:40 PM
  • Open up the Command window(run->cmd or "Win"+"R") and type: C:\Users\xxx\sqllocaldb delete "v11.0" The following row should be shown: LocalDB instance "v11.0" deleted Then type the following row: C:\Users\xxx\sqllocaldb create "v11.0" The following row should be shown: LocalDB instance "v11.0" created with version 11.0

    • Proposed as answer by NiceStepUp Friday, August 21, 2015 11:52 PM
    • Edited by NiceStepUp Saturday, August 22, 2015 12:28 AM
    Friday, August 21, 2015 11:51 PM