Unable to open the connection to SQL Server, SQL Server

Source: Internet
Author: User
Tags mssqlserver

Unable to open the connection to SQL Server, SQL Server


After several days of login to the restructured version of the data room charging system, the login form was finally knocked out, and the code debugging was almost done, and the problem was in the database.

The SQL Server Service in SQL Server Configuration Management is started, but this error is still reported: Network-related or instance-specific errors occur when you establish a connection with SQL Server. The server is not found or cannot be accessed. Verify that the Instance name is correct and SQL Server is configured to allow remote connection. (Provider: Named Pipes Provider, error: 40-unable to open the connection to SQL Server)


There is no connection to the database at all. If you are depressed, you cannot solve the problem. Finally, we found a solution.

Solution:

Step 1: Start TCP/I in the SQL Server network configuration and change the IP address to your own IP address. The TCP port is 1433.



Step 2: Open SQL Server, right click ----->. Modify the content in the server configuration and peripheral application configuration.

In the server configuration, all RemoteAccessEnabled, RemoteDaEnabled, and RemoteProcTransEnabled are set to True.


Set RemoteDaEnabled in the peripheral application configurator to True.


The next step is to create an exception in the firewall. The next step is to create an exception in the firewall. Open Control Panel-system and security-Windows Control Panel-permitted programs.

Find the file directory in which sqlserver.exe is located and add it. (The path here can be found based on the differences and differences of each person's installation)

Added.


Finally, restart the SQL Server service in SQL Server Configuration Management.

Let's see if my system can be connected to the database.


No problem. Log in successfully.

After several days of login, I tried it all from Layer 3 to Layer 7, using the appearance mode, abstract factory, reflection, configuration file, stored procedure, and SqlHepler. There are many problems, big and small, but they are always exhausted. The subsequent functions will give you a deeper understanding of the content and continue to learn.



Provider: named pipeline provider, error: 40-unable to open the connection to SQL Server more likely to first check whether the MSSQLSERVER service is enabled

Check whether the connection string is correct. If the Instance name is correct, the database connection string of the same version is the same.

Check whether the Database Engine allows remote TCP/IP connections. The engine and external adapter are enabled.

Also, if you have installed software such as 360, it can intercept database access.
(Provider: named pipeline provider, error: 40-unable to open the connection to SQL Server (Microsoft SQL Server, this error occurs because SQL Server uses the "Windows only" authentication method, so you cannot use the SQL Server Logon account (sa) to connect. solution: 1. on the Server side, use the Enterprise Manager and select "use Windows Authentication" to connect to the SQL Server Enterprise Manager -- Right-click the Server instance (with a green icon) -- edit SQL Server Registration Attributes -- select "use windows Authentication" 2. expand "SQL Server group", right-click the SQL Server name, select "properties", and then select "security" tab 3. under "authentication", select "SQL Server and Windows ". 4. restart the SQL Server service. to solve the problem, use "use Windows Authentication" to connect to SQL Server fails to solve this problem by modifying the Registry: 1. click "start"-"run", enter regedit, and press enter to enter Registry Editor 2. expand the registry key in sequence and browse the registry key: [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSSQLServer] 3. find the name "LoginMode" on the right of the screen, and double-click to edit the double byte value. 4. change the original value from 1 to 2 and click "OK" 5. disable Registry Editor


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.