簡體   English   中英

Databricks SQL 服務器連接使用集成身份驗證

[英]Databricks SQL Server connection using integrated authentication

我正在嘗試使用 python 將我的 Databricks 集群連接到現有的 SQL 服務器數據庫。 我想利用集成的身份驗證方法。 出現錯誤com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

jdbcHostname = "sampledb-dev.database.windows.net"
jdbcPort= 1433
jdbcDatabase = "sampledb-dev"
jdbcUrl = "jdbc:sqlserver://{0}:{1}; database={2}".format(jdbcHostname, jdbcPort, jdbcDatabase)

connectionProperties={
  "integratedSecurity" : "true",
  "driver" : "com.microsoft.sqlserver.jdbc.SQLServerDriver"
}

print(jdbcUrl)
query ="(SELECT * FROM TABLE1.Domain)"

domains = spark.read.jdbc(url = jdbcUrl, table = query, properties = connectionProperties)
display(domains) 

您不能在 Azure PaaS 數據庫中使用integratedSecurity=true IntegratedSecurity是一種內部部署結構。

您需要使用authentication=ActiveDirectoryIntegratedauthentication=ActiveDirectoryPassword ,請參閱 JDBC 文檔: https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-using-azure-active-directory-auth視圖=sql-server-ver15

您還需要您的帳戶是對該數據庫具有適當權限的用戶,該數據庫與 Azure AD 同步。 如果您使用多重身份驗證,則 JDBC 不支持,您的管理員需要為您提供未啟用 MFA 的帳戶。 您會知道是否是這種情況,因為您在嘗試連接時會收到WSTrust錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM