An error occurred while connecting to SQLSERVER by using an IP address or configuring it as a connection string.

Source: Internet
Author: User
Scenario 1: When addkeyConnectionStringvalueserver127.0.0.1, database name, and u are used in the webconfig file to connect to the database, the database cannot be logged on normally, A lot of errors have occurred. Scenario 2:

Use an IP address to connect to SQL SERVER or configure it as a connection string. Scenario 1: Use add key = "ConnectionString" value = "server = 127.0.0.1; database = database name in the webconfig file; uid = sa; pwd = 1 "/to connect to the database and find that the database cannot be logged on normally, resulting in a lot of errors. Scenario 2: or when

Failed to connect to SQL SERVER by using IP address or configuring as connection string

Scenario 1: when used in the webconfig File

To connect to the database, and found that the login failed, a lot of errors;

Scenario 2:

Alternatively, when you connect to SQL SERVER, enter the following IP Address:

The system prompts that a connection fails or a connection error occurs.

Solution:

Step 1: Check whether the TCP/IP protocol is Enabled:

In the "Start" menu, find "Configuration tools" in microsoft SQL server 2005, open SQL SERVER Configuration Manager, and click in. Select the SQLEXPRESS protocol ,, in "TCP/IP" on the right, double-click it and enable it if "disabled" is displayed:

Step 2: Select "MSSQLSERVER protocol" and enable "TCP/IP"

Step 3: select the subnode "Client protocol" in "SQL Native Client configuration" and check whether the "TCP/IP" Protocol on the right is enabled. If not, enable it:

Step 4: Double-click "TCP/IP protocol" to view the properties panel and check whether the listening port is port 1433.

Step 5: restart the computer ~~ Test logon ~~ Succeeded ~~~

Additional:

If "local" or "localhost" cannot be used

Solution:

Open the C: \ Windows \ System32 \ drivers \ etc path and find

Hosts file;

Open it in notepad to see if there are any examples:

# Localhost name resolution is handled within DNS itself.

#127.0.0.1 localhost

If not, add them below;

Then restart the computer ~~ OK ~~

========================================================== ========================================================== ===

Welcome to exchange and learn QQ: 392989505

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.