Remote connection and database connection after the SQL server port changes

Source: Internet
Author: User

1. Add port to the connection string when connecting to the database

SQL Server Port: We can use "server network trial tool" and "client utility"

The setting method is as follows:

· Use "server network trial tool" and "client utility" respectively"

· Set the default port in "general options"-> "enabled protocol"-> "TCP/IP"-> "attribute", which is assumed to be 1455

· Then test whether your port is valid. You can use Telnet SQL server address 1455.

Check whether telnet is available. If yes, perform the following test:

In the past, there was no port number in writing, so it is easy to write. But now the port number has been changed, and many friends are not very clear about how to write the connection statement. the following database connection statement is the form after the port is changed:

Set oconn = server. Createobject ("ADODB. Connection ")

Sconn = "driver = {SQL Server}; server = server address, 1455;

Database = database; uid = user name; Pwd = password ;"

Oconn. Open sconn

2. After the change, you will be prompted "the server does not exist" during remote connection.

We can find that the port number is not connected. At this time, we need to make some settings for the local server. Open SQL Server> Client Network Tools> alias> Add to add the IP address of your remote server. Select TCP/IP in the network library, and then remove the dynamic port selection hook, add the port changed by the remote server. In this case, you can establish a remote connection and do not need to write the port number during the connection.

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.