Cannot connect to Databricks SQL Endpoint using PHP and ODBC

Rex
New Contributor III

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-...

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

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. In my view, everything matches the documentation.

I did try using the Databricks driver in my odbc.ini file:

Driver=/opt/simba/spark/lib/64/libsparkodbc_sb64.so

But I get the error Can't open lib '/opt/simba/spark/lib/64/libsparkodbc_sb64.so' : file not found

However, the file does exist:

ls /opt/simba/spark/lib/64/libsparkodbc_sb64.so
-rwxrwxrwx 1 root root 76265161 Oct 26 20:51 /opt/simba/spark/lib/64/libsparkodbc_sb64.so

Anything else I should try?

I also asked this on StackOverflow: https://stackoverflow.com/questions/71271023/cannot-connect-to-databricks-sql-endpoint-using-php-and...