Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when i Try to connect sql server it makes error like "A network-related or instance-specific error occured while establishing a connection to sql sever.The server was not found or was not accessible.verify that the instance name is correct and that Sql Server is configured o allow remote connections.(provider:Shared Memory Provider,error:40-Could not open a connection to Sql Server( (Microsoft Sql Server ,Error:2)".last day it work fine.next day i got error like this.

also in Sql server Configuration manager sql server service stopped.when i try to start it make error like "the request failed or the service did not respond in a timely fashion.Consult the event log or other applicable error logs for details".

So what is the Error... Advance Thanks
Posted

1 solution

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 machinename\instancename
• Check your connection string as well
HTML
<connectionstrings>
<add name=""SampleConnectionString"" connectionstring=""Data" source="pashadkulkarni\myDB;Initial" catalog="TestDatabase;Integrated" security="SSPI;Min" pool="" size="5;Max" timeout="30″" providername=""System.Data.SqlClient"/">
</add></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 Server\MSSQL.x\MSSQL\Binn), 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.

And also have a look Here[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900