简体   繁体   English

如何将数据库连接到 Azure Blob 中的数据文件?

[英]How to connect database to data files in Azure Blob?

This resource states that a Azure SQL database may be attached to a database by using the following command: 该资源声明可以使用以下命令将 Azure SQL 数据库附加到数据库:

WITH IDENTITY='SHARED ACCESS SIGNATURE',  
SECRET = '<your SAS key>'  
  
CREATE DATABASE testdb   
ON  
( NAME = testdb_dat,  
    FILENAME = 'https://testdb.blob.core.windows.net/data/TestData.mdf' )  
 LOG ON  
( NAME = testdb_log,  
    FILENAME =  'https://testdb.blob.core.windows.net/data/TestLog.ldf') 

This results in Syntax Error near "ON".这会导致“ON”附近出现语法错误。 What is the issue here?这里的问题是什么?

To connect Azure SQL Database to Azure blob storage, you need to create an external data source with the database scoped credentials.要将 Azure SQL 数据库连接到 Azure blob 存储,您需要使用数据库范围的凭据创建外部数据源

CREATE DATABASE SCOPED CREDENTIAL BlobCred
WITH
IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'SAS token' ;

CREATE EXTERNAL DATA SOURCE BlobStg
WITH
 ( LOCATION =‘https://storagename.blob.core.windows.net’,
CREDENTIAL = BlobCred,
TYPE = BLOB_STORAGE
) ;

Refer to official documents this & this for more details.有关详细信息,请参阅官方文档this & this

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

相关问题 如何在Azure数据工厂中启用SSL连接到DB2数据库? - How to connect to DB2 database with SSL enabled in Azure Data Factory? 如何使用 Airflow 将 CSV 文件从 Azure Data Lake/Blob 存储传输到 PostgreSQL 数据库 - How to transfer a CSV file from Azure Data Lake/Blob Storage to PostgreSQL database with Airflow Azure 逻辑应用程序如何将多个 JSON 文件合并到 Blob 存储 - Azure Logic Apps how to combine multiple JSON files to Blob storage azure 数据湖客户端与 azure blob 客户端有何不同 - how azure data lake client different from azure blob client 连接到自定义域上的 Azure blob 存储 - Connect to Azure blob storage on custom domain 如何使用 Ballerina 连接到 Azure SQL 数据库 - How do I connect to Azure SQL Database with Ballerina 如何使用 EPPlus 库从 Excel 中保存在 azure 中的 blob 文件中读取数据 - How to read data from Excel File saved in an blob in azure with EPPlus library 如何从存储在Azure blob存储中的json文件中获取数据 - How to get data from json file stored in Azure blob storage in react 如何通过python anaconda jupyter连接Azure sql数据库 - How to connect to Azure sql database through python anaconda jupyter C# - 如何将文件上传到 Azure 存储 Blob(未知物理路径) - C# - How to upload files to Azure Storage Blob (unknown phisic path)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM