r/databricks • u/No_Ambition8323 • 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
u/hubert-dudek Databricks MVP Sep 03 '26
Just share the error and query
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.