Resolving “A network-related or instance-specific error occurred while establishing a connection to SQL Server…”

SQL Server 2005 Error:
“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) ”

Things to check:
1. Make sure your database engine is configured to accept remote connections
• Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
• Click on Surface Area Configuration for Services and Connections
• Select the instance that is having a problem > Database Engine > Remote Connections
• Enable local and remote connections
• Restart instance

2. Check the SQL Server service account
• If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding

3. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
• Usually the format needed to specify the database server is machinenameinstancename
• Check your connection string as well

<connectionStrings>

<add name=”SampleConnectionString” connectionString=”Data Source=machinenameinstancename;Initial Catalog=AdventureWorks;Integrated Security=SSPI;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30″ providerName=”System.Data.SqlClient”/>

</connectionStrings>

4.You may need to create an exception on the firewall for the SQL Server instance and port you are using
• Start > Run > Firewall.cpl
• Click on exceptions tab
• Add the sqlservr.exe (typically located in C:Program Files (x86)Microsoft SQL ServerMSSQL.xMSSQLBinn), and port (default is 1433)
• Check your connection string as well

5. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings

6. Check SQLBrowser; check that it is running. You may also need to create an exception in your firewall for SQLBrowser.

7. Check that you have connectivity to the SQL Server. Note what you are using to connect: machine name, domain name or IP address? Use this when checking connectivity. For example if you are using myserver
• Start > Run > cmd
•netstat -ano| findstr 1433
•telnet myserver 1433
•ping -a myserver

Check what ports are IP addresses are being returned.

Alternative:
If you still can’t get any connection, you may want to create a SQL account on the server, a corresponding SQL user on the database in question, and just use this username/password combo in your web application.

Advertisements

97 comments

  • Great post.
    Just thought you might like to see someone who has scraped your work and passed it off as their own. Scumbags.

    http://sqlservererror-info.blogspot.com/2010/09/network-related-or-instance-specific.html

    Like

    • Thanks Andy. Not sure what to do with the plagiarism. All I can do is to ask them to take those pages down. I saw another site that had a handful of my articles! Ironically they also passed off that they “also” work at Black Ninja …

      Like

  • Great post, the firewall exception was what I needed

    Cheers,
    SteveC.

    Like

  • #6 was my problem, also. Thanks so much for this post!

    Like

  • Same issue here, had DPM 2007 with sql 2005, upgraded to dpm 2010 and sql 2008. Ran a repair on sql 2008 shared components and error resolved.

    Like

  • Nothing is working, Ive tried to completly disable every firewall on my machine including the antivirus, every step you said. I cannot connect to my sql express.

    I have it insatlled on my devellopement machine and I try to connect via the local network. It detects the server when I browse it but cant connect.

    Like

  • pls somebody help me i cannot instal sqlserver 2005 coz it cannot find the ipaddress. cannot connect to remote connection. i dunno whats lacking….

    Like

  • I believe
    • Enable local and remote connections
    was my answer.
    Thanks you for great help.

    Like

  • Belzaleel Madrigal Jasso

    Only Restart Server and login again…

    Like

  • THANK YOU Sir! It helps me VERY MUCH!!! Helpful, very Helpful INDEED! =)

    Like

  • Many thinks, number 3 got me.

    Like

  • Great post, the firewall exception was what I needed

    Like

  • Thanks a lot, that saved me stressing out about not being able to do my assignment.

    Like

  • Muhammad Niaz Qureshi

    Hi

    I am having the problem to connect to SQL Server. I have developed an application in VB.Net one client computer where it is running. But on the other client it could not connect to Sql Server.

    Fire wall is disabled on client. But enabled on server.

    any one help me.

    Like

  • I was having the same issue with SQL 2005 Express on Windows 7. Issue was resolved by adding UDP port 1434 (SQL Browser) to my inbound and outbound firewall rules.

    Like

  • Thank you it helped me identify the problem. sqlservice was stopping.

    Girum

    Like

  • Mohammed Mudassir

    In the SQL server configuration manager, there is an item called SQL server network configuration, under protocols, I selected the properties of the TCP/IP protocol. There is a tab “IP Addresses” there, and at the bottom of the list is an entry called IPAll. In my case the TCP port was empty. I entered the SQL standard port 1433 in there and I was able to connect.

    This should work!

    Like

  • Hi. I had trouble with number 4. I assumed that once you have disabled the firewall, everything should work fine. Unknown to me, everyone will notice that in windows 7 and server 2008R2, disabling firewall does not stop the machine from blocking programs not on the allowed list.
    Great help.. thanks.

    Like

  • awesome big clap!!!

    thx a lot

    Like

  • Please help to me it is error how is it solove.

    SQL Server 2005 Error:
    “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) ”

    Like

  • 75.Mohammed Mudassir – Sir you are my hero! I’ve tried all those steps mentioned none of it work except your method. I was able to connect remotely to my sql 2008 server withouth any error from other apps that connect to my sql 2008 server with no problem but for some reason why i try to connect to it from my system center service mananger server it doesn’t work but your suggestion is what makes it work. I’ve been working on this for over three days. Btw Iam not a dba guy, just starting to managing our sql environment.

    Like

  • I need to create a SQL Server 2008 Database programatically. And then add three tables in that database. And for connecting to sql server i need to use SQL Data client. I am unable to create a SQL Server Database programatically. Everyone it is showing how to create tables in a existing database. Please help!!
    Thanks a lot in advance.

    Like

  • Apart from this, when migrating from development environment to another it can be simply that this error occurs due to the presence of incorrect connection string. I recommend going through all items that make use of connection strings. This is where programming best practices are best used. Basically “Use only one connection string”.

    Like

  • GO START -> ALL PROGRAMS -> SQL SERVER 2008/2005/2008 R2
    ->CONFIGURATION TOOLS->
    ->SELECT SQL SERVER CONFIGURATION MANAGER
    ->SELECT SQL SERVER NETWORK CONFIGURATION
    ->SELECT PROTOCOLS FOR MSSQLSERVER(YOUR INSTANT NAME)
    ->IN RIGHT TASK PANEL
    ->MAKE SURE MENTION BELOW:

    DISABLE SHARED MEMORY AND VIA
    ENABLE NAMED PIPE AND TCP/IP

    —-MAKE SAME THING IN
    ->SQL NATIVE CLIENT 10.0(SERVER VERSION) CONFIGURATION – CLIENT PROTOCOLS

    RESTART SQL SERVER(MSSQLSERVER [YOUR INSTANT NAME]) SERVICE

    Like

  • Hi

    Can You Please help me? I get following error after Upgrading

    SQL Server 2008 to SP2 , Unable to connect to SQL Server Named Insatnce after using SSMS . The Network Service Stops when I try to connect using SSMS

    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: TCP Provider, error: 0 – No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

    Thanks for your help

    Regards

    Dave

    Like

  • Check the SQL services (Start –> Settings –> Control Panel –> Administrative Tools –> Services) and switch all “Disabled” services to “Automatic”

    I hope this help you.

    Like

  • I get the same error msg after adding a login form in Microsoft Visual Studio 2008 but with SQL Server 2008. Confusing, there is somewhere it says “SQLExpress database file auto-creation error: ” while I don’t use Express version, I use Enteprise version. How can I solve this?

    Like

  • Wow Excellent Explanation.

    Like

  • Hi and tanx for your good recommendations!
    Could you update this topic for sql server 2008 and windows7?

    Like

  • Thank you, it helped me connect to my SQL server 🙂

    Like

  • Pingback: can not connect to database engine - dBforums

  • I was getting numerous errors on my SharePoint farm after migrating to a new SQL 2008 R2 cluster (running on Windows 2008 R2). After about a month of troubleshooting, I decided to update my network card drivers on the new SQL cluster (Broadcom II). This fixed all the SQL “network-related” errors for me.

    Like

  • Issue with the connection to SQLExpress
    This is the connectin string that I have given
    SqlConnection myConnection = new SqlConnection(“Server=GINOJVISWAM/SQLEXPRESS;AttachDbFileName=D:/DotNet-Studies/SQLServer/WebSiteCheck/App_Data/PUBS.mdf;Database=PUBS;Trusted_Connection=False;”);
    myConnection.Open();.
    Is there any issue with the string. Any help would be appreciated.

    Like

  • when i am trying to send data into another computer sql server 2005 using windows forms application in .net ‘it shows error message “Login Failed fpr DEEPAK/guest” . please help me i am in trouble , please help me………

    Like

  • Pingback: SQL 2005/2008/R2 N/W connection error troubleshooting steps « Ramblings of a SQL DBA mind…

  • Hi,

    Background:
    SQLExpress 2012, Visual Studio 2012 running Win 7 Ent 64 bit, App in VB.Net
    SQLconnStr = “Server=MYCOMPUTERSQLEXPRESS;Initial Catalog=APPDB;Integrated Security=SSPI”
    Both SQLExpress and Visual Studio are running on the same computer.

    Problem:
    I kept getting SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified whenever I tried to connect to the database.

    Troubleshooting:
    All network connections are enabled in the Server – named pipe, tcp, and shared memory.
    Ran it with Win Firewall turned off – still the problem persist.
    Ensure Win Firewall has port 1433 enabled – problem still persist.
    Ping server – ok, sqlcmd -L – return the right serverinstance
    SQL Management Studio – connects with no problem
    Ensure remote connection is enabled on the server
    Install the SQLExpress 2012 on another machine running Win 8, ran same App – No problem

    Very puzzled, can someone shed some light? Thanks in advance!

    Like

  • writing IP ADDRESSMSSQLSERVER2008 solved my problem

    Like

  • Thanks, it is working..

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s