无法使用 PHP 和 ODBC 连接到 Databricks SQL Endpoint

发布于 2025-01-10 03:23:49 字数 1269 浏览 0 评论 0原文

我正在尝试在 Docker 容器中使用 PHP 连接到我们的 Databricks SQL 端点。

我设置 Docker 容器来下载并配置此处指定的 ODBC 驱动程序: https://docs.databricks.com/integrations/bi/jdbc-odbc-bi.html#install-and-configure-the-odbc-driver-for-linux

我的 Docker 设置位于 < a href="https://github.com/rlorenzo/databricks_php" rel="nofollow noreferrer">https://github.com/rlorenzo/databricks_php

但是,当它尝试从我的 PHP 测试脚本使用 ODBC 连接我收到错误:

Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000 in SQLConnect in /test_connection.php on line 14
ODBC connect failed: S1000

当我尝试使用 PDO 库连接时,我收到不同的错误消息:

SQLSTATE[08S01] SQLConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist

连接详细信息是正确的,因为我能够使用 Datagrip。我还可以验证 ODBC 库是否已正确安装,因为我可以查询 Microsoft SQL Server。

我一定是 Databricks ODBC 连接器配置错误,但我一无所知。在我看来,一切都与文档相符。

我已尝试联系 Databricks 支持人员,但到目前为止他们没有提供任何帮助。

I am trying to connect to our Databricks SQL endpoint using PHP in a Docker container.

I setup my Docker container to download and configure the ODBC driver as specified here: https://docs.databricks.com/integrations/bi/jdbc-odbc-bi.html#install-and-configure-the-odbc-driver-for-linux

My Docker setup is at https://github.com/rlorenzo/databricks_php

However, when it try to connect using ODBC from my PHP test script I get the error:

Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000 in SQLConnect in /test_connection.php on line 14
ODBC connect failed: S1000

When I try to connect using the PDO library I get a different error message:

SQLSTATE[08S01] SQLConnect: 20009 [unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist

The connection details are correct because I was able to connect to the Databricks SQL endpoint using Datagrip. I can also verify that the ODBC library is properly installed because I can query a Microsoft SQL Server.

I must have the Databricks ODBC Connector misconfigured somehow, but I am clueless. From my view everything matches the documentation.

I have tried contacting Databricks support, but they have been unhelpful so far.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淤浪 2025-01-17 03:23:49

问题是 Databricks SQL 驱动程序尚不支持 ARM,而我的笔记本电脑和 Docker 容器正是针对 ARM 构建的。请参阅 ('01000', "[01000] [unixODBC ][驱动程序管理器]无法打开lib '/opt/simba/spark/lib/64/libsparkodbc_sb64.so':找不到文件 (0) (SQLDriverConnect)")

我在 https://github.com/rlorenzo/databricks_php 带有一个工作示例并强制构建容器x86 版本。

如果 Databricks 支持 ARM,将更新我的存储库。

希望这对将来的人有帮助。

The problem was that the Databricks SQL driver does not yet support ARM, which my laptop and Docker container was building for. See ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/simba/spark/lib/64/libsparkodbc_sb64.so' : file not found (0) (SQLDriverConnect)")

I updated my repo at https://github.com/rlorenzo/databricks_php with a working example and forced the container to build an x86 version.

Will update my repo if Databricks ever supports ARM.

Hope this helps someone in the future.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文