【发布时间】:2020-09-03 14:33:58
【问题描述】:
我想将数据从 MS SQL 数据库(未托管在 Azure 上)检索到 Microsoft Azure Databricks 笔记本。 以下是我所做的步骤:
- 进入天蓝色的门户,创建资源组
- 创建 Azure Databricks 服务(但我不使用“在您自己的虚拟网络 (VNet) 中部署 Azure Databricks 工作区”选项 → 也许我应该...)
- Azure Databricks 服务准备就绪后,我启动它并创建一个没有特定配置的集群
- 然后我用这个脚本创建一个笔记本(在之前的集群上运行)
msSqlServer = "jdbc:sqlserver://xxx.xxx.xxx.xxx:1433;ApplicationIntent=readonly;databaseName=" + msSqlDatabase
query = """(select * from mytable)foo"""
df = (
spark.read.format("jdbc")
.option("url", msSqlServer)
.option("dbtable", query)
.option("user", msSqlUser)
.option("password", msSqlPassword)
.load()
)
我得到这个错误:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host xxx.xxx.xxx.xxx, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
在询问 StackoverFlow 之前,我已经联系了我的公司网络和 DBA 团队。 DBA 说连接正常,但立即断开连接”
为了您的信息,我已经按照这个教程https://docs.microsoft.com/en-us/azure/databricks/data/data-sources/sql-databases
也许需要配置一些东西,但我根本不在网络中(我只是一个小数据科学家,想在 azure databricks 上玩 notebook 并访问他的公司数据库)。比如我怎么Make sure that TCP connections to the port are not blocked by a firewall?
如果您有一些想法或者您已经遇到过这个问题,请随时分享。 :)
如果您需要更多信息,请告诉我。
【问题讨论】:
-
你能发布你的步骤吗?或者将您正在使用的代码放入响应中。删除您的特定凭据
-
感谢您的回复。我已经添加了一些信息,希望对您有所帮助。
标签: sql-server apache-spark azure-databricks