rlorenzo
rlorenzo

Reputation: 1368

Cannot connect to Databricks SQL Endpoint using PHP and ODBC

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.

Upvotes: 0

Views: 1111

Answers (1)

rlorenzo
rlorenzo

Reputation: 1368

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.

Upvotes: 0

Related Questions