[英]Connect to SQL Azure DB using OpenRowSet from on-premise SQL Server
I am trying to connect to SQL Azure database from an on-premise SQL Server using openrowset
, but it is failing with an error. 我正在尝试使用
openrowset
从本地SQL Server连接到SQL Azure数据库,但是失败并出现错误。
My query is 我的查询是
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=sqlazureserver.database.windows.net;Database=dbname;User ID=username;Password=password;Connection Timeout=30;', 'select * from [dbo].[tablename]') AS a;
and the error I get: 和我得到的错误:
Msg 7399, Level 16, State 1, Line 11
消息7399,第16层,状态1,第11行
The OLE DB provider "SQLNCLI11" for linked server "(null)" reported an error.链接服务器“(null)”的OLE DB提供程序“ SQLNCLI11”报告了一个错误。 Authentication failed.
验证失败。
Msg 7303, Level 16, State 1, Line 11Msg 7303,第16级,状态1,第11行
Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "(null)".无法为链接服务器“(null)”初始化OLE DB提供程序“ SQLNCLI11”的数据源对象。
I am able to successfully connect using linked server, but I do not want to go that route as my connection strings will be dynamic. 我能够使用链接服务器成功连接,但是由于我的连接字符串是动态的,所以我不想走那条路线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.