无法使用链接服务器连接到 SQL Azure
我一直在这里关注这篇文章:
http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx
了解如何设置从 SQL Server 2008 R2 到 SQL Azure 实例的链接服务器。我使用 SQL Native Client 10.0 作为 ODBC 驱动程序,并根据显示的默认数据库判断连接是否有效;但是,当我尝试按照上面的文章建议建立链接服务器时;我收到以下错误:
链接服务器“Azure_Test”的 OLE DB 提供程序“MSDASQL”返回消息“[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序”。
现在我看到一些论坛帖子(不幸的是没有结论)表明这可能是 64 位问题。有人成功从本地实例设置到 SQL Azure 的链接服务器吗?
编辑:大卫的回答确实是正确的;只是想我会分享这个我发现你现在可以使用链接服务器完成的令人惊叹的事情:
DELETE OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable');
INSERT OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable')
SELECT *
FROM static.MyTable
SELECT * FROM OPENQUERY(AzureTest, 'SELECT * FROM [AzureDB].static.MyTable')
I've been following this article here:
http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx
on how to setup a Linked Server from SQL Server 2008 R2 to an SQL Azure instance. I am using SQL Native Client 10.0 as the ODBC driver and judging by the default databases that are shown the connection is valid; however when I attempt to establish a linked server as the above article suggests; I get the following error:
OLE DB provider "MSDASQL" for linked server "Azure_Test" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Now I've seen a few forum posts (Nothing conclusive unfortunately) suggesting it may be a 64bit issue. Has anyone successfully setup a Linked Server to SQL Azure from a local instance?
EDIT: Davids answer was indeed correct; just thought I'd share this awesomeness I found you can do now with a linked server:
DELETE OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable');
INSERT OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable')
SELECT *
FROM static.MyTable
SELECT * FROM OPENQUERY(AzureTest, 'SELECT * FROM [AzureDB].static.MyTable')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已按照您链接到的文档中列出的步骤完成了此操作。
下面是让它为我工作所需的两个 SQL 语句:
我将 ODBC 连接设置为系统 DSN(我最初将其设置为用户 DSN,但遇到了一些问题)。我只是使用了我的服务器名称(前面没有“tcp:”)——azureServer.database.windows.net。一旦我设置了 DSN 并运行了上面的三个语句,它就工作得很好。我可以毫无问题地执行这个语句:
我不确定这是否有帮助 - 但我希望它有帮助。祝你好运!
I have done this, following the steps that are listed in the document that you linked to.
Here were the two SQL statements that I needed to make it work for me:
I set my ODBC connection up as a SYSTEM DSN (I originally set it as a User DSN and had some issues). I just used my server name (no 'tcp:' in front) -- azureServer.database.windows.net. Once I set up the DSN and ran the three statements above, it worked fine. I could execute this statement without issue:
I'm not sure if this helps or not - but I hope it does. Good luck!