Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write a small app that will log into SQL Server to perform some admin functions. When I connect to SQL Server using the following connection string, I can log in fine:

Data Source=Localhost\SqlExpress;Initial Catalog=PeteDb;User Id=sa;Password=test;

However when I want to use integrated:

Data Source=Localhost\SqlExpress;Integrated Security=True;MultipleActiveResultSets=True"

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: 26 - Error Locating Server/Instance Specified)

How can this be solved? I am in the list of logins.

share|improve this question

migrated from Nov 16 '11 at 8:16

This question came from our site for professional and enthusiast programmers.

Do you need to specify the Initial catalog in the 2nd connection string? Something like this:

Data Source=Localhost\SqlExpress;Initial Catalog=PeteDb;Integrated Security=True;
share|improve this answer
I want to log into the master db, plus it works on another machine :-( – Pete2k Nov 2 '11 at 21:06
Does the sa/test login work when you specify InitialCatalog=master? – JohnD Nov 2 '11 at 21:08

Had the same issue setting up and instance of SQL Server. This tutorial worked for me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.