SQL Server connection in LAN

Source: Internet
Author: User

Problem description:

The SQL database is placed on a server in the LAN. The online workstation can connect to the SQL database through the query analyzer and the Enterprise Manager.
However, a few machines cannot connect to the SQL database, and query analyzer or Enterprise Manager cannot. A connection error occurs. However, it is okay for these machines to connect to the SQL database on other servers. It is only possible to connect to this SQL database.

Generally, there are several possibilities:

 

Answer:

1. incorrect spelling of the SQL server name or IP address
2. The server network configuration is incorrect.
3. The client network configuration is incorrect.

To solve this problem, we generally need to follow the steps below to find out the cause of the error step by step.


============== First, check the network physical connection ================
Ping <Server IP Address/Server Name>

If the ping <Server IP address> fails, the physical connection is faulty. In this case, Check hardware devices, such as NICs, hubs, and routers.
Another possibility is that a firewall software is installed between the client and the server. For example, the ISA Server. firewall software may block the Ping and telnet responses.
Therefore, when checking for connection problems, we must temporarily disable the firewall software or open all closed ports.

If the ping <Server IP address> succeeds, the ping <Server Name> fails.
It indicates that there is a problem with name resolution. At this time, check whether the DNS service is normal.
Sometimes the client and server are not in the same LAN. At this time, the server name may not be used to identify the server. At this time, we can use the hosts file for name resolution,
The specific method is:

1. Use notepad to open the hosts file (usually in c: \ winnt \ system32 \ drivers \ etc ).
Add a record corresponding to the IP address and server name, for example:
172.1610.24 myserver

2. You can also configure it in the SQL Server Client Network utility, which will be described in detail later.


============ Second, use the Telnet command to check the running status of the SQL Server server ==============
Telnet <Server IP addresses> 1433

If the command is successfully executed, you can see that the cursor keeps flashing in the upper left corner after the screen flashes. This indicates that the SQL Server is working normally and is listening for TCP/IP connection at port 1433.
If the command returns an error message "unable to open the connection", it indicates that the server has not started the SQL Server service,
The TCP/IP protocol may not be enabled on the server, or the server does not listen on the default port 1433 of SQL Server.


Then, we need to check the network configuration on the server and whether the named pipe is enabled. whether or not the TCP/IP protocol is enabled ================
SQL Server's built-in server network tools can be used for inspection.

Click: Program -- Microsoft SQL Server -- server network tools

After you open the tool, you can see which protocols are enabled on the server in "General.
In general, we enable Named Pipes and TCP/IP protocols.
Click "properties" in the TCP/IP protocol to check the default port settings of the sqk Server service.
Generally, we use the default port 1433 of SQL Server. if you select "Hide server", it means that the client cannot see this server by enumerating the server. This protects the server, but does not affect the connection.


============== Next we will go to the client to check the network configuration of the client ================
We can also use the client network tools provided by SQL Server to perform checks,
The difference is that this tool is run on the client this time.

Click: program -- Microsoft SQL Server -- client network usage Tool

After the tool is enabled, You can see which protocols are enabled on the client in the "General" item.
In general, we also need to enable the named pipe and TCP/IP protocol.
Click TCP/IP protocol and select "properties" to check the default connection port settings of the client. The port must be consistent with the server.

Click the "alias" tab and configure the alias for the server. The server alias is the name used for connection,
The server in the connection parameter is the real server name. The two can be the same or different. The alias settings are similar to those in the hosts file.


Through the above checks, the first error can be basically ruled out.

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.