Method 1:
1) sqlserver service uses two ports: TCP-1433, UDP-1434. 1433 is used to provide external services for sqlserver, and 1434 is used to return the TCP/IP Port used by sqlserver to the requester.
You can use the Enterprise Manager of SQL Server to change the default TCP port of SQL Server. The method is as follows:
A. Open Enterprise Manager, select "Microsoft SQL servers-SQL Server group" in the left-side toolbar, and open "SQL instance" (the name of the SQL Server server to be modified in the actual environment) in the Properties dialog box, click "network configuration (n)" at the bottom of the "General" tab to open the "SQL SERVER network tools" dialog box.
B. There are TCP/IP protocols in the "enabled protocols" list. Enter the port number to be modified in the default port options in the properties. Another option is to hide the server. If this option is selected, the client cannot view this server by enumerating the server, which protects the server and does not affect the connection.
2) The SQLAgent Service provides services using TCP-1625 and TCP-1640 ports.
3) the SQL query analyzer accesses port 1601 and connects to sqlserver.
Method 2:
Open Microsoft SQL Server -- server network utility -- enabled protocol -- TCP/IP -- properties -- default port
The above method should be modified after the server is stopped.
Note: Run-cmd-Telnet 127.0.0.1 1433 on another computer to check whether the database port can be connected to the server. If the database port cannot be connected, check whether the listening port of the database server is 1433, if you do not have a normal listening database port, SP4 may not be installed and you need to install the SP4 patch.
The client configuration is as follows: Open Microsoft SQL Server -- client network utility -- alias and add the corresponding IP address and port.
The ADO string connection is as follows:
"Provider = sqloledb.1; persist Security info = false; Data Source = 127.0.0.1, 2001; network library = dbmssocn; user id = **; Password = **; initial catalog = tempdb ";