Troubleshooting: Sql Server 2008 error 40 has a connection error solution

SQL column

Summary of SQL basics

SQL advanced knowledge summary

There are often small partners who report connection errors. Today, I will reproduce this error and the solution for everyone. Next time, if a small partner also encounters a similar problem, you can directly forward this article to him. Okay, let's start the experiment.

Failure to reproduce
40 There are many connection errors, first to reproduce a relatively common. As shown below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

Is it familiar?

In the first case, the fault is solved
. There are many reasons for this error, but in the final analysis, it is still related to the database service. Since it is related to the service, let's go to the service of the database and follow me.

Right-click [My Computer]-select [Manage]-find [Services and Applications] in the pop-up management window-find [SQL Server Configuration Manager], as shown below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

Click [SQL Server Service], on the right side of the window we can see what services SQL Server has, as shown in the figure below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

Let me explain to you what services these names correspond to

SQL Server Integration Services: This service corresponds to a service that manages the storage and execution of SSIS packages. SSIS is an ETL tool for SQL Server. This component is only available when SQL Server is installed. It will not be displayed if it is not installed.

SQL Server (MSSQLSERVER): This is the service of our database engine. The name of the database instance is in parentheses. Multiple instances can be installed on a computer, and different instances correspond to different services.

SQL Server Browser: It is mainly to pass the connection information of SQL Server to the client. If it stops, the information cannot be passed to the client normally.

SQL Server Agent: This is a tool used to automate some tasks. After stopping, these auto-executed tasks will also stop.

It can be seen above that our database engine service has been stopped, we will start it: right-click to select [SQL Server (MSSQLSERVER)], and click Start. Let's try again to see if we can connect normally.

After the service is started, it can be connected normally, as shown in the figure below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

This means that our connection is successful.

In the second case, the fault is solved.
What should I do if the above services cannot be started?

As shown below

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

At this time we need to perform additional configuration.

Or open the [Services and Applications] just now, find [SQL Server Configuration Manager], and click SQL Server Network Configuration, as shown below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

On the right side of the window we can see a series of agreements, as shown below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

Right-click TCP/IP-Properties-select IP address in the pop-up window, as shown below:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

A large part of the above problem occurs because the TCP port of the IPAll option is empty, which causes tcp/ip to be unable to monitor port 1433 and the database engine service cannot be started. At this time, simply change the TCP port to 1433.

Another possibility is that the Via protocol is enabled, because the Via protocol is also monitoring port 1433, which causes the database engine service to fail to start. At this time, the Via protocol can be disabled, as shown in the following figure:

Troubleshooting: Sql Server 2008 error 40 has a connection error solution

Well, today’s troubleshooting will stop here, and other faults are welcome to leave a message below or add my personal WeChat: liyue071714118

Guess you like

Origin blog.51cto.com/15057820/2656468