外部连接 - 存储仿真器 [英] External Connection - Storage Emulator

查看:81
本文介绍了外部连接 - 存储仿真器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试将我的本地SQL Server数据库实例作为外部连接连接到blob存储模拟器,但是我得到了一个"指定的位置不佳或无法进入"错误。以下是我正在采取的步骤:

I'm trying to connect my local SQL Server database instance to the blob storage emulator as an external connection, however I'm getting a "Bad or inaccessible location specified" error. Here are the steps I'm taking:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<password>';
GO

-- Create the credentials using the generic storage account key
CREATE DATABASE SCOPED CREDENTIAL localBlobStorageCredential
WITH IDENTITY = 'devstoreaccount1',
SECRET = 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==';
GO

-- Create the data source pointing to the blob storage location I created (blob-storage-location)
CREATE EXTERNAL DATA SOURCE localBlobStorage
WITH (
    TYPE = BLOB_STORAGE,
    LOCATION = 'http://127.0.0.1:10000/devstoreaccount1/blob-storage-location',
    CREDENTIAL= localBlobStorageCredential
);
GO

-- Attempt to select a file that has been uploaded (cp.json)
SELECT * FROM OPENROWSET(
	BULK 'cp.json',
	SINGLE_BLOB,
	DATA_SOURCE = 'localBlobStorage'
) AS j;

然后我收到以下错误:

Bad or inaccessible location specified in external data source "localBlobStorage".

任何想法?

问候,

詹姆斯

推荐答案

Hello James,

Hello James,

对于延迟回复感到抱歉, 

Sorry for the delayed response, 

您是否检查过包含文件的blob存储的位置路径?如果文件在容器内,那么你需要提供blob容器的完整URL,如'https://sqlchoice.blob.core.windows.net/sqlchoice/'

Did you check the location path of the blob storage which contains files? If the files are inside the container, then you need to give the full URL of blob container like ‘https://sqlchoice.blob.core.windows.net/sqlchoice/’

,您需要在参数(-with Identity)中提供SAS(共享访问签名),而不是存储帐户名。我建议你参考类似的讨论

here

here

Also, you need to give the SAS (Shared access signature) in the parameter (–with Identity) instead of storage account name. I would suggest you to refer the similar discussion here and here.

您还可以查看
here
 了解如何使用存储资源管理器生成SAS 。看看这对你有帮助。

You can also check here to know how to generate the SAS using storage explorer. See if this helps you.


这篇关于外部连接 - 存储仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆