error:1326 error occurred in SQL Server
When we use SQL Server, we encounter problems using SQL Server Management Studio to connect to a remote database instance, and an excerpt of the error description is as follows:
An error has occurred while establishing a connection to the server.
(provider:named pipes provider, error:40–could not open a connection to SQL Server) (Microsoft SQL Server, Error:5)
An error has occurred while establishing a connection to the server. When connecting to SQL Server in failure, this is caused by the fact that under the default settings SQL server does not allow remote connections. (provider:named pipes provider, error:40–could not open a connection to SQL Server) (Microsoft SQL Server, error:1326)
The above translation of English is probably to say: cannot establish a connection between the database, because the named pipe provider has an error. In fact, this is a typical database server settings problem, in the LAN or WAN may encounter, we only need to do some configuration of the database server can solve this problem, to see the specific steps.
First step: Make sure that the server-side database service is started
Start-> All Programs->microsoft SQL Server 2008->configutation Tools, open SQL Server Configuration Manager, click SQL Server Services, to see if the database service has started, and to start it manually if the service is not turned on. Of course, you can also see if the corresponding database service is started by clicking the Start-> Control Panel->-> service in Windows. Or if the server and your machine are on the same network, you can also view all the available SQL Server servers in the network by using the command "sqlcmd-l" (note L to capitalize).
Step two: Enable TCP/IP in SQL Server configuration
The need for TCP/IP support for multiple SQL Server servers to communicate over the network is required to ensure that TCP/IP is enabled for the SQL Server server to be connected remotely. Follow the steps described earlier to open SQL Server Configuration Manager, and then open SQL Server network Configuration, select the database you want to set up, and then click TCP/IP and right-click to enable. If necessary, you can also enable named pipes. Keep in mind that all modifications must be completed before the SQL Server service can be restarted!
Step three: Open the port number of SQL Server in Windows Firewall
A lot of times we still can't make a remote connection when we set up many times on the database server itself, and we need to consider whether the firewall is at work. By default, many port numbers and services are blocked by firewalls and cannot be accessed or executed remotely, and the default port number for SQL Server is no exception. We should reset Windows Firewall to add exceptions to SQL Server. Unless you modify it by default, SQL Server's port number is 1433, adding the port number to Windows Firewall. If SQL Server has a named instance, you should also add SQL Server Browser to Windows Firewall. (a named instance of SQL Server is described later)
Open Windows Control Panel and select Windows Firewall->change settings->exceptions->add Port
Click Add Port ... In the pop-up dialog box, fill in:
Name:sql
Port number:1433
Protocol:select TCP
Step Fourth: Enable remote connections in SQL Server Manager
This step is typically ignored by the database administrator, and enabling remote connections is also important if the database remote connection is not enabled and the database instance only allows local connectivity and cannot be remotely connected. Remote connections are disabled in the default settings. In the following illustration, open SQL Server Management Studio, right-click the database instance and select the Properties menu.
In the open window, select Connections on the left and check "Allow remote connections to this server".
Step Fifth: Enable the SQL Server Browser service
If SQL Server does not install with a default instance name but a custom instance name and does not have a specific TCP/IP port number configured, SQL Server still cannot support remote connections as we described earlier. However, if you enable the SQL Server Browser service, remote SQL Server connections can be made through the dynamic TCP/IP port number. Enabling SQL Server Browser service is very simple, similar to enabling SQL Server, right-click SQL Server Browser in SQL Server Configuration Manager, and then select Enable. Enabling this service will affect all installed instances of SQL Server on the server.
Step Sixth: Create an exception for the Sqlbrowser.exe application in the firewall
As we mentioned earlier, a custom named SQL Server instance that supports remote connections requires the SQLBrowser service to be enabled, and Windows Firewall may prevent the service from executing. Therefore, we must add an exception to the SQLBrowser service in Windows Firewall.
First locate the path to install the Sqlbrowser.exe program on the server, such as C:\Program Files\Microsoft SQL Server\90\shared\sqlbrowser.exe. If you are unsure where SQL Server is installed, you can search for a filename in Windows. Similar to the method we introduced earlier to add the SQL TCP/IP port number in the firewall, add a firewall exception to the Sqlbrowser.exe application.
Finally: Re-create the database alias
It is common to create SQL Server aliases and use them in your applications. Using a database alias ensures that the database connection string in your application is not modified once the location of the database changes, such as when a new server is replaced, the IP address changes, and so on. If you change the location of the database, you should also notify all applications that use the database to modify the connection string in the source code or configuration file, which is probably impossible. Therefore, it is a wise choice to use a database alias to configure the connection string. In addition, you can use the same alias to point to different database instances, when modifying the alias parameters, you can immediately implement the switch between the database. Creating a database alias is simple, and you choose Aliases in SQL Server Configuration Manager to create it.
add:sqlservr.exe is the service PID is 1760, occupy the port number is 1433, check that the port is occupied, you can use Telnet localhost 1433 to view, but also through Netstat IP | Find "1433" to specific who occupies. Summary: 1. A look at the user name, password, 22 to see if the settings allow remote connections, 33 to see if the firewall to protect the 1433 (do not know if you can directly shut down the firewall to try)
Thank you for reading, I hope to help you, thank you for your support for this site!