13

I try to connect through: Microsoft SQL Server Database File (SqlClient), but I recieve 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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)

So, i click Connect to Database in Server Explorer

http://i.imgur.com/9SVttQn.png

This window show up. In which i choose: Microsoft SQL Server Database File (SqlClient) and then browse my .mdf database file.

enter image description here

Clicking ok gives error mentioned before:

enter image description here

Server is running, I use windows authentication in database. Any sugestions?

7
  • From the error message, sounds like configuration issue. You can confirm that 1. You have SQL Server Express and not sql server 2. The mdf is a sql server express database and not from another version of sql server Commented Jun 1, 2013 at 22:12
  • 1. I have SQL Server 2008 R2 2. mdf is from same version. Commented Jun 1, 2013 at 22:16
  • Is F: a local or mapped network drive? Commented Jun 1, 2013 at 22:20
  • Local, everything is local. Commented Jun 1, 2013 at 22:20
  • 4
    Sql Server 2008 R2 is NOT express. Just attach the DB in sql server management studio and then do a normal connection to the database Commented Jun 1, 2013 at 22:35

3 Answers 3

18

You need the SQL Server Express LocalDB add-on, you can get it from here in both x86 & amd64 versions.

Sign up to request clarification or add additional context in comments.

3 Comments

your solution solved my problem. I installed x64 for my 64 bit machine.
Check which version you need, Installed that version and still had errors. Ended up needing to install Sql Express 2014 from here to fix my issue - microsoft.com/en-my/download/details.aspx?id=42299
For anyone still looking into this issue, the links have updated for the LocalDB add-on: learn.microsoft.com/en-us/sql/database-engine/configure-windows/… Ensuring that the LocalDB package was installed on my VM solved the issue!
2

I had faced same issue when I deployed my software on test machine.
Solution:

  1. Check the SQL server version using which the .mdf was build. If you don't know execute command SELECT @@VERSION.
  2. Install correct version of SqlLocalDB.msi from following link.
    http://www.microsoft.com/en-us/download/details.aspx?id=29062 http://www.microsoft.com/en-my/download/details.aspx?id=42299.

Comments

0

Try to use SQL Server Authentication. Make sure that your SQL service is running or not. I think this will help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.