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:
| The code is as follows: |
Copy code |
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" when you are remotely connecting.
1) open SQLServer-Configuration tool-SQL Server Configuration Manager
2) select "Aliases" (alias) and right-click "new" to add an alias, port number, server name, and Protocol (note that both the alias and server IP address must be an IP address)
3) reconnect. Enter the SQL Server address and the user name and password to connect to the Server.