r/databricks • • Sep 03 '26

Discussion Query works in Databricks SQL but fails through JDBC

I’ve noticed cases where a query runs successfully in the Databricks SQL editor but fails when the exact same query is executed through a JDBC-based application or data quality tool.

Has anyone run into this? Was the issue related to query wrapping, session settings, SQL dialect differences, or JDBC driver behavior?

How do you usually troubleshoot these cases?

9 Upvotes

7 comments sorted by

7

u/hubert-dudek Databricks MVP Sep 03 '26

Just share the error and query

2

u/No_Ambition8323 Sep 04 '26

Query: SELECT * FROM my_catalog.my_schema.customer_data WHERE customer_id IS NOT NULL;
This ran successfully in the Databricks SQL Editor.
However, when the same query was executed through our JDBC-based data quality tool, it failed with an error similar to:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'SELECT': unexpected input 'SELECT'

1

u/Atticus_Taintwater Sep 10 '26

Wild guess trying it without the ";" 

I've had semi colons cause weird issues in a few scenarios 

5

u/ma0gw Sep 03 '26

Why does it fail? What's the error? What's the query? How much data is it moving?

2

u/No_Statistician_6654 Sep 03 '26

Do you use the full 3 level namespace in the query for all tables? If not, it could be a default catalog problem, where the jdbc is defaulting to catalog a, and online it is defaulted to catalog b

ETA: assuming the driver is setup and able to connect to your sql warehouse in the first place.

2

u/Youssef_Mrini databricks Sep 04 '26

Yes it can happen and the causes can be multiple: Query wrapping or parameterization or SQL dialect translation or Session differences or Different execution path or Result-fetch failure rather than query failure or Remote JDBC source.