Network reference: http://www.cnblogs.com/noviceliu/archive/2007/10/22/933134.html
For the database system that has just been installed, if it is installed by default, it is likely that an error is reported during remote connection. The common error is: "When you connect to SQL Server 2005, this failure may occur if SQL server does not allow remote connection by default. (Provider: named pipeline provider, error: 40-unable to open the connection to SQL Server) "Search msdn, The Machine Translation article above is hard to understand, the following is a summary: I understand that SQL Server is a network database and can be easily solved. It is simply divided into the following concentrated situations.
1. The database engine is not started.
There are two startup methods:
(1) Start-> Program-> Microsoft SQL Server 2005-> SQL Server 2005 peripheral application configurator. On the displayed page, click "peripheral application configurator for service connection ", on the displayed page, find the database engine and click "service". Check whether the service is started on the right side. If not, click "start" and make sure "Start type" is automatic, do not manually start the instance. Otherwise, the instance must be manually started the next time it is started;
(2) You can choose Start> program> Microsoft SQL Server 2005> Configuration tool> SQL Server Configuration Manager, and select SQL Server (MSSQLServer) in SQL Server 2005 ), click "Start Service" in the toolbar to change the service status to start;
When using the above two methods, sometimes an error may occur during startup, and cannot be started, in this case, check whether the Via in SQL Server 2005 network configuration> MSSQLServer protocol is enabled in "SQL Server 2005 Configuration Manager". If yes, disable it. then, execute the preceding operation.
2. Whether remote connection is allowed.
This part can be simply divided into four aspects, enable remote connection on SQL Server, enable SQL Server browsing service, create exceptions for SQL Server 2005 in Windows Firewall, and create exceptions for "sqlbrowser" in Windows Firewall. The following are some specific operations. From msdn, I personally think that the simhei part of the article should be paid special attention to together.
Enable remote connection on an sqlserver instance
1. Point to "start-> Program-> Microsoft SQL Server 2005-> Configuration tool-> SQL Server peripheral application configurator"
2. on the "SQL Server 2005 peripheral application configurator" page, click "service and connected peripheral application configurator"
3. Click expand database engine and select remote connection ",Select "local connection and remote connection" on the right side ",
Select the Protocol to use (TCP/IP and named pipe service should be enabled here !)Click "application" and you will see the following message:
"The changes made to the connection settings will not take effect until the Database Engine service is restarted .", Click OK to return
4. Expand "Database Engine", select "service", click "stop" on the right side, and wait until the MSSQLServer service is stopped,
Click Start to restart the MSSQLServer service.
Enable sqlserver Browser Service
1. Point to "start-> Program-> Microsoft SQL Server 2005-> Configuration tool-> SQL Server peripheral application configurator"
2. on the "SQL Server 2005 peripheral application configurator" page, click "service and connected peripheral application configurator"
3. Click expand "SQL Server Browser", select "service", and select "automatic" in "Startup Type" on the right ",
Click Start and then click OK to return
In Windows Firewall 2005" Create exceptions
1. on the Windows Firewall settings page, select the "exceptions" tab and click "add program"
2. In the add program window, click browse"
3. Then find "C: \ ProgramFiles \ microsoft files \ Microsoft SQL Server \ mssql.1 \ MSSQL \ binn \ sqlservr.exe ",
Click OK to return
Note: the path may vary depending on SQL Server 2005 installation. Mssql.1 is a placeholder that corresponds to the database instance id.
4. Repeat steps 1 to 3 for each SQL Server 2005 instance that requires remote access.
Create an exception for "sqlbrowser" in Windows Firewall
1. on the Windows Firewall settings page, select the "exceptions" tab and click "add program"
2. In the add program window, click browse"
3.Then find "C: \ ProgramFiles \ microsoft files \ Microsoft SQL Server \ 90 \ shared \ sqlbrowser.exe ",
Click OK to return
Note: the path may vary depending on SQL Server 2005 installation.
In use. NET development, you will encounter the problem of using the connection string to connect to the SQL Server 2005 database using the machine name and localhost can be connected, but the use of IP addresses can not be connected, the solution is to enable local and remote connections on the SQL server instance, and use the TCP/IP and named pipeline services when selecting the protocol.
Official help:
Details |
Product: |
SQL Server |
ID: |
-1 |
Source: |
MSSQLServer |
Version: |
9.0 |
Component: |
Sqlengine |
Message: |
An error has occurred while establishing a connection to the server. when connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL server does not allow remote connections. (provider: SQL network interfaces, error: 28-server doesn't support requested protocol) (Microsoft SQL Server, error:-1) |
|
Explanation |
The SQL Server client cannot connect to the server. This error cocould be caused by one of the following reasons: The firewall on the server has refused the connection. A specified SQL server instance name is not valid. The SQL Server Browser Service (sqlbrowser) is not started. |
|
User action |
To resolve this error, try one of the following actions: Make sure that you have configured the firewall on the server instance of SQL Server to open the SQL Server Browser port. Make sure that the SQL Server Browser Service is started on the server. Check the spelling of the SQL server instance name that is specified in the connection string. Use the SQL Server surface area Configuration tool to enable SQL Server to accept remote connections. For more information about the SQL Server surface area Configuration tool, see surface area configuration for services and connections. |
Solution: I started to look for the LAN server through browsing, and finally changed it to the server IP address to solve the problem!