简体   繁体   English

无法使用Microsoft Excel Power Query连接到SQL Server

[英]Cannot connect to SQL Server using Microsoft Excel Power Query

I'm having trouble connecting to a SQL Server 2008 R2 data source using Excel 2013 Power Query. 我无法使用Excel 2013 Power Query连接到SQL Server 2008 R2数据源。

I have created a new Power Query query, and created a new SQL Server datasource. 我创建了一个新的Power Query查询,并创建了一个新的SQL Server数据源。 I have specified the server name and database, but have not specified any specific query. 我已指定服务器名称和数据库,但未指定任何特定查询。

I am using SQL Server authentication to login to the database, and the connection is encrypted. 我正在使用SQL Server身份验证登录到数据库,并且连接已加密。

When I attempt to set up the connection in Excel Power Query, I get an error message: DataSource.Error: 当我尝试在Excel Power Query中设置连接时,出现错误消息:DataSource.Error:

No further error details are supplied. 没有提供进一步的错误详细信息。

I have checked that the SQL Server allows remote connections, and I have tested the SQL Login by using the sqlcmd utility to connect to the database server and database and run a basic SELECT query. 我已经检查了SQL Server是否允许远程连接,并且已经通过使用sqlcmd实用程序连接到数据库服务器和数据库并运行基本的SELECT查询来测试SQL登录。

If anyone can shed any light on what I'm doing wrong, I'd be very grateful. 如果有人能阐明我做错了什么,我将非常感谢。

For anyone reading this in 2017: 对于在2017年阅读此内容的任何人:

If you are using Windows 7 and above, use the driver listed in the ODBC Data Sources. 如果您使用的是Windows 7及更高版本,请使用ODBC数据源中列出的驱动程序。 The only case where I had to install a client and driver, was when I wanted to connect to an oracle database. 我必须安装客户端和驱动程序的唯一情况是当我想连接到oracle数据库时。

To setup and connect to SQL server, I opened ODBC Data Sources, selected 'Add', chose the SQL server option (not native client versions) and added the server and database details where prompted. 要设置并连接到SQL Server,我打开ODBC数据源,选择“添加”,选择SQL Server选项(不是本机客户端版本),并在提示时添加服务器和数据库详细信息。 Then test the connection from ODBC data sources. 然后测试来自ODBC数据源的连接。

My SQL server connections usually require full TNS info all the way from server name, then database name despite the claim that it's optional. 我的SQL Server连接通常要求从服务器名称到数据库名称一直提供完整的TNS信息,尽管声称它是可选的。

Do you have the odbc driver? 您有odbc驱动程序吗?
I have run into this problem previously when I tried to connect remotely. 以前,当我尝试远程连接时遇到了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM