设置 微软 SQL 服务器 连接器
Three things decide whether a SQL Server connection works: the right server name, a server that accepts network connections, and a SQL Server login. This page walks through each, plus Azure, Amazon RDS and Google Cloud SQL.
你最终会得到什么
A Microsoft SQL Server connection in 数据代理 测试 已连接, with the databases you want ticked, ready for Excel, Google Sheets, an AI assistant or the REST API. The Agent reads your data where it lives; nothing is copied into Query Streams.
经纪人需要什么
An Agent that can reach the server
On Windows, Mac or Linux. The SQL Server client is built into the Agent, so there is no driver to install. Not installed yet? 在 Windows 上安装代理.
A SQL Server login
A login name and password that SQL Server itself checks, not your Windows sign-in. Best a read-only one: create a read-only login.
The server name
Something like OFFICE-SERVER, 192.168.1.20 或 OFFICE-SERVER\SQLEXPRESS. Not sure? Find the server name.
The easiest way round most of this. If you can install programs on the computer that runs SQL Server, install the Agent there. No firewall rule is needed then, and the server name is simply 本地主机 (或) localhost\SQLEXPRESS for SQL Express).
添加连接
-
Open the form
打开 数据代理 (在下面 数据 点击顶部菜单中的按钮), 添加连接器 on your Agent and choose 微软 SQL 服务器. Database on Azure, Amazon or Google? Pick that provider’s own card instead; see the cloud sections below.
-
Fill in five boxes
- 连接名称
- Any name you will recognise, like Sales server.
- 服务器
- The server name, typed exactly as described in Find the server name. There is no Database box: you pick the database after the test.
- 港口
- 离开 1433, including for a named instance such as OFFICE-SERVER\SQLEXPRESS. The line under the box says the same: Leave 1433 for a named instance (host\INSTANCE); the server’s SQL Browser finds the port. Enter a port only if the instance uses a fixed one.
- Username / Password
- The SQL Server login. The boxes start empty.
离开 连接超时(秒), Encrypt Connection 和 Trust Server Certificate as they are (why the last two do not matter today).
-
Click Test connection
A green 已连接 means the Agent signed in; the button changes to 下一页. An amber Signed in means the login works but needs a database name: carry on, the next step asks for it (details). A red Connection failed comes with a message: find it in 测试失败?.
-
Pick the database and create
点击 下一页。 在下面 Which databases do you want to work with? tick yours, click 下一页, choose a Data realm, 点击 下一页然后 创建连接器.
Test button greyed out? The Agent is offline: follow Is the Agent online? 第一的。
When something is in the way
Each section below is one situation, one action per step, with what you should see after it.
Find the server name
SQL Server can run several copies side by side on one computer, called instances. The first is usually the default instance and has no name of its own; any other, including every SQL Express install, has a name such as SQLEXPRESS. The Server box needs the computer and, for a named instance, the instance.
Not comfortable with this? Ask whoever looks after your database (often the company that supplied your accounting or till software) “what server name do I connect to?”, or reply to support and we will find it with you.
-
See which instances are installed
On the SQL Server computer, click Start and type SQL Server Configuration Manager. If nothing appears, type the file name for your version and press Enter: SQLServerManager16.msc for SQL Server 2022, SQLServerManager15.msc for 2019, SQLServerManager14.msc for 2017, SQLServerManager17.msc for 2025. Click 是 if Windows asks for permission.
In the list on the left click SQL Server Services. Each line that starts SQL Server ( is one instance. SQL Server (MSSQLSERVER) is the default instance. Anything else in the brackets, such as SQL Server (SQLEXPRESS), is a named instance, and that word is its name.
-
Find the computer’s name
On the same computer click Start然后 设置然后 System然后 About. The line Device name is the computer’s name, for example OFFICE-SERVER. Its IP address, such as 192.168.1.20, works too.
-
Or ask SQL Server itself
If you have SQL Server Management Studio (SSMS), the Connect to Server box it opens with already shows the Server name people use. Once connected, click New Query, paste the line below and press F5:
Paste into the query window, then press F5SELECT @@SERVERNAME;
The result is the name in the right shape, for example OFFICE-SERVER\SQLEXPRESS.
-
Type it in the right shape
What you have 服务器 港口 Default instance OFFICE-SERVER 或 192.168.1.20 1433 Named instance (SQL Express) OFFICE-SERVER\SQLEXPRESS 1433. This means “ask the server’s SQL Server Browser for the real port”. Named instance with a fixed port OFFICE-SERVER That port, for example 50123. Any port other than 1433 makes the Agent connect to that port directly and drop the instance name. A name with a comma, such as sql.example.com,14330 Paste it as it is 离开 1433; the port after the comma wins. A name with a colon, such as sql.example.com:14330 Paste it as it is The Agent reads the colon as the comma SQL Server expects. SQL Server on the Agent’s own computer 本地主机 或 localhost\SQLEXPRESS 1433. 本地主机 means the Agent’s computer, not the one you are typing on. (localdb)\MSSQLLocalDB Will not work, and the form says so under the box: LocalDB runs inside your Windows login session; the agent service cannot open it. Attach the database to a SQL Server or SQL Express instance and enter that server. Ask whoever built the app to move the database to SQL Server or SQL Express. As you type, a line under the 服务器 box confirms how it was read:
- Named instance, Port 1433
- Named instance: the server’s SQL Browser finds the port. Leave Port at 1433.
- Named instance, another port
- A port other than 1433 is set, so the instance name is ignored: the agent connects to host,port. If you meant the instance, set Port back to 1433.
- A colon before the port
- Read as host,port. SQL Server separates the port with a comma; the agent accepts both.
- localhost, (local) or .
- localhost, (local) and . mean the computer the agent runs on, not this one.
Reading named instances this way needs Agent 2.6.23 or newer (released 9 October 2026). Older Agents fail every named instance with Connection failed: Cannot establish TCP connection to SQL Server; the Agent updates itself, and this page covers one that has not.
If any of this does not match what you see, stop and reply to our support email with a photo of the screen. We will walk you through it.
If it is SQL Express or another named instance
A fresh SQL Express install accepts connections only from its own computer: TCP/IP, the setting that lets other computers in, starts turned off. A named instance also relies on a helper service, SQL Server 浏览器, to tell the Agent which port it is on. The steps below turn both on. You need to be an administrator on the SQL Server computer.
Not comfortable with this? Ask whoever looks after the server to “enable TCP/IP for the SQLEXPRESS instance and set SQL Server Browser to Automatic”, or reply to support and we will do it with you.
-
Open SQL Server Configuration Manager
On the SQL Server computer, open it as in Find the server name, step 1. A window opens with a list on the left.
-
Look at TCP/IP for your instance
In the list on the left, expand SQL Server Network Configuration 并点击 Protocols for SQLEXPRESS (your instance’s name after “for”). On the right are Shared Memory, Named Pipes 和 TCP/IP, each with a status. If TCP/IP already says 已启用, skip to step 5.
-
Enable TCP/IP
Right-click TCP/IP 并选择 Enable. A message says the change only takes effect when the service restarts; click 好的. The status now reads 已启用, but nothing has changed yet.
-
Restart the instance
In the list on the left click SQL Server Services. On the right, right-click SQL Server (SQLEXPRESS) 并选择 Restart. The icon beside it shows a red square, then a green arrow, within a few seconds. Anyone using the database is disconnected for those seconds, so pick a quiet moment.
-
Set SQL Server Browser to start by itself
In the same list find SQL Server 浏览器 and read its Start Mode column. If it says Automatic, go to step 6. If it says 手册 或 Other (Boot, System, Disabled or Unknown), double-click SQL Server 浏览器, click the Service tab, set Start Mode 至 Automatic然后点击 好的.
-
Start SQL Server Browser
If its State column does not say Running, right-click SQL Server 浏览器 并选择 Start. The State changes to Running。 如果 Start is greyed out, step 5 did not save; do it again.
-
Open the firewall, if the Agent is on another computer
A named instance needs two Windows Firewall rules on the SQL Server computer: UDP 1434 for the Browser and TCP for the instance’s own port. Open a firewall port on Windows: named instances shows how to read that port (under IPAll), make it fixed so it stops changing after a restart, and add both rules. Agent on the SQL Server computer itself? Skip this step.
-
再次测试
Back in the Portal, keep 服务器 作为 OFFICE-SERVER\SQLEXPRESS 和 港口 作为 1433; the line under Server reads Named instance: the server’s SQL Browser finds the port. Leave Port at 1433. 点击 再次测试. If you gave the instance a fixed port in step 7, you can instead type that port in 港口; the Browser and the UDP rule are then not needed.
If any of this does not match what you see, stop and reply to our support email with a photo of the screen. We will walk you through it.
If the test says “Login failed” and the password is right
Many SQL Server and SQL Express installs accept only Windows accounts until one setting is changed, and the connector signs in with a SQL Server login. While that setting is off, the test says Connection failed: Login failed for user ‘qs_reader’. That is word for word what a wrong password gives, so it is easy to retype the password again and again. If you are sure of the password, this is the reason.
Not comfortable with this? Ask whoever looks after your database to “turn on SQL Server and Windows Authentication mode”, or reply to support and we will do it with you.
-
Open SSMS and connect
On the SQL Server computer open SQL Server Management Studio. In the Connect to Server box leave 验证 在 Windows 身份验证 并点击 连接. A panel called Object Explorer appears on the left with the server name at the top.
-
Open the server’s Security page
Right-click the server name at the very top of Object Explorer and choose 属性. In the list on the left of the window that opens, click 安全。 在下面 Server authentication there are two choices.
-
Allow SQL Server logins
如果 SQL Server and Windows Authentication mode is already selected, click Cancel: the setting is fine, so the login or password is wrong; go to step 5. Otherwise click it, then 好的. A message says the change takes effect after SQL Server restarts; click 好的.
-
Restart SQL Server
Right-click the server name again, choose Restart然后点击 是. The icon by the server name turns grey and back to green in under a minute.
-
Make sure the login exists
展开 安全然后 Logins. If the name you typed in the Portal is not listed, create it: Create a read-only database user: SQL Server has a paste-in version and a click-through one. Untick User must change password at next login; the Agent cannot change a password, so with that ticked it never gets in.
-
再次测试
Back in the Portal, click 再次测试. 已连接 means you are through.
If any of this does not match what you see, stop and reply to our support email with a photo of the screen. We will walk you through it.
Encrypt Connection and Trust Server Certificate
Leave both boxes as they are. Today the Agent ignores them: it asks for no encryption and trusts whatever certificate the server shows. In practice:
- A server with a self-signed certificate connects without a certificate error. The Agent’s test never fails on a certificate today.
- A server that insists on encryption still gets it. Azure SQL always does; your own SQL Server does when its administrator has set Force Encryption.
- Otherwise the hop between the Agent and SQL Server is not encrypted, so it is best kept inside your own network. The Agent’s link to Query Streams is encrypted either way.
This is a known issue and is being fixed. SSMS on your own computer is different: if it says The certificate chain was issued by an authority that is not trusted, tick Trust Server Certificate in its Connect to Server box.
If your database is Azure SQL Database
Not comfortable with this? Ask whoever manages your Azure account to “allow this IP address through the SQL server firewall”, or reply to support.
-
Copy the server name
在 Azure portal 打开 SQL 数据库 and click your database. Its overview page shows the full server name, such as myserver.database.windows.net. Copy it.
-
Let the Agent’s address through
On the same page click Set server firewall. Set Public network access 至 Selected networks点击 Add a firewall rule and enter the public IP address of the Agent’s computer (on that computer, search the web for “what is my IP”). Add your client IP adds the address of the computer your browser is on, which is only right if the Agent is on the same network. Click 节省.
-
Use the Azure SQL card
In the Portal choose Azure SQL instead of Microsoft SQL Server. In Azure, on your database’s page, open 连接字符串 并复制 ADO.NET one into Connection String (paste ADO.NET from the Azure portal); the boxes below fill in. It starts Server=tcp:; that tcp: is fine, the Agent drops it. Azure shows the password as {your_password}, so type the real one into 密码.
-
Name your database and test
The Azure SQL card has a 数据库 box, because Azure ties each connection to one database. Type your database’s name, not master然后点击 测试连接. Serverless databases pause when idle; the first test after a pause can take a minute.
If any of this does not match what you see, stop and reply to our support email with a photo of the screen. We will walk you through it.
If it is Azure SQL Managed Instance
A Managed Instance lives inside an Azure virtual network. Either install the Agent on a machine in that network and use the instance’s normal host name, or turn on its public endpoint:
-
Enable the public endpoint
In the Azure portal open the SQL managed instance. Under 安全 点击 Networking, 选择 Enable for the public endpoint, and click 节省.
-
Allow port 3342
Your network administrator adds an inbound rule to the instance’s network security group: TCP, destination port 3342, source the Agent computer’s public IP, with a lower priority number than the deny_all_inbound rule.
-
Enter the public host name
在下面 设置, 连接字符串 shows the public host, shaped name.public.zone.database.windows.net. In the Portal choose 微软 SQL 服务器, put that host in 服务器 和 3342 在 港口 (or paste name.public.zone.database.windows.net,3342 into Server and leave 1433), then test.
On any Azure host, a test without a database name can come back amber Signed in 与 This login needs a database name to sign in. even when the password is wrong. If 核实 then fails on a database you know exists, recheck the password.
If your database is Amazon RDS for SQL Server
-
Copy the endpoint
在 Amazon RDS console 选择 数据库, click your SQL Server instance, and on the 连接性和安全性 tab copy the 端点 and note the 港口.
-
Let the Agent in
Unless the Agent runs inside the same VPC, the instance needs Public accessibility 设置为 是, and its VPC security group needs an inbound rule for that port from the Agent computer’s public IP. (My IP as the source fills in the address of the computer your browser is on.)
-
Use the Amazon RDS card
In the Portal choose 亚马逊 RDS and paste the endpoint with its port, such as mydb.abc123.us-east-1.rds.amazonaws.com:1433, into Endpoint or Connection String (paste from the RDS console). Port 1433 sets Database Engine 至 SQL 服务器; check it did, since the card starts on PostgreSQL. Username is the master username or a login you created. Then test.
If your database is Google Cloud SQL for SQL Server
-
Authorise the Agent’s address
在 Cloud SQL instances page click your instance, then 连接 in the menu, then the Networking tab. With Public IP ticked, under Authorized networks 点击 Add network, put the Agent computer’s public IP in 网络, 点击 完成然后 节省.
-
Use the Google Cloud SQL card
In the Portal choose Google Cloud SQL, set Database Engine 至 SQL 服务器, type the instance’s public IP (on its overview page) in Instance IP address, and change 港口 至 1433; it starts at 5432, PostgreSQL’s port. Running the Cloud SQL Auth Proxy on the Agent’s computer instead? Use 127.0.0.1.
After the test: pick the database
The connector has no Database box; the database is chosen on the step after a good test. What you see there depends on the login:
- A list of databases
- 在下面 Which databases do you want to work with? tick yours. System databases such as master carry a system chip and are never ticked for you. You can tick up to five; the first is the Primary, used when a query does not name a database.
- “This login can’t list databases”
- Type the name in Type a database name 并点击 核实. You should see Sales added. (with your database’s name). Sales doesn’t exist or this login can’t open it. means a typo, or the login has no user in that database; What the agent said shows SQL Server’s own words, and the read-only login page shows how to map the login to it.
- An amber “Signed in” after the test
- The test says No database opened yet. Name it on the next step. followed by This login needs a database name to sign in. Enter your database. (Azure) or Signed in, but this login’s default database can’t be opened. Enter your database. Nothing is broken. Click 下一页, type the database name and click 核实.
Then click 下一页, choose a Data realm, 点击 下一页, check the summary and click 创建连接器. The Agent then reads the table list of each ticked database.
测试失败?
The message after Connection failed tells you which of these it is. Names in capitals stand for yours.
| 留言 | 原因 | 使固定 |
|---|---|---|
| Connection failed: nothing answered on HOST:1433. SQL Server is not listening on that port, or a firewall between the agent and the server blocks it. | TCP/IP is off for the instance, SQL Server is stopped, a firewall blocks the port, or the server name is mistyped. | Check the name (Find the server name), 然后 turn on TCP/IP然后 open the port. |
| Connection failed: instance "SQLEXPRESS" was not found on HOST. followed by The SQL Server Browser service must be running on the server… | SQL Server Browser stopped, TCP/IP off, UDP 1434 or the instance port blocked, or the instance name misspelt. | If it is SQL Express or another named instance. |
| Connection failed: Cannot establish TCP connection to SQL Server | An Agent older than 2.6.23 with a named instance, or any of the causes in the first row. | Update the Agent (如何), then test again. |
| Under the Server box, before any test: LocalDB runs inside your Windows login session; the agent service cannot open it. From the test itself:Connection failed: (localdb)\MSSQLLocalDB is a LocalDB instance. | LocalDB cannot be opened by a service. | Move the database to SQL Server or SQL Express and enter that server. |
| Connection failed: Login failed for user ‘NAME’. | Wrong password, the login does not exist, or the server accepts Windows accounts only. Today all three read the same. | Retype the password once; then If the test says “Login failed”. |
| Amber Signed in, 和 Enter your database. | The login works but needs a database name. | Pick the database. |
| On Verify: DATABASE doesn’t exist or this login can’t open it. | A typo, or the login is not mapped to that database. | Check the spelling; map the login with User Mapping. |
| A message containing Client with IP address … is not allowed to access the server | Azure’s firewall. The address in the message is the Agent’s. | Add that exact address: Azure SQL, step 2. |
| A message starting Connection failed: A network-related or instance-specific error occurred | 和 本地主机: SQL Server is not running on the Agent’s computer. Otherwise the server or instance could not be reached. | 查看 SQL Server (…) is Running in Configuration Manager on the right computer, then the rows above. |
| A message mentioning timeout | Something silently drops the traffic (often a firewall on the instance’s own port), or a paused Azure serverless database is waking. | Wait a minute and test again; then check both firewall rules. |
| The certificate chain was issued by an authority that is not trusted | Comes from SSMS or another tool, not from the Agent today. | In that tool tick Trust Server Certificate (为什么). |
| Test button greyed out: Agent is offline — start the agent to test the connection | The Agent is not connected. | Is the Agent online? |
接下来:使用数据
- Microsoft SQL Server to Excel
- Microsoft SQL Server 到 Google Sheets
- SQL Server in Claude and other AI assistants (MCP)
- SQL Server as a REST API
相关指南
Setup trouble?
- Agent shows Offline, or Test connection and Browse are greyed out? Check that the Agent is online → Is the Agent online?

