emma_s
Databricks Employee
Databricks Employee

Hi, 

I haven't come across this issue myself but according to some internal resources I think the following fix may work.

This is a known issue introduced in ODBC driver version 2.8.0. The root cause is that the default for EnableNativeParameterizedQuery was changed from 1 to 0 in that release (to protect Power BI users). Without it, the driver's client-side SQL parser tries to rewrite parameterized queries but fails on DML statements like INSERT — it sends unresolved internal parameter names (_53, _67, etc.) to the server, which causes the UNBOUND_SQL_PARAMETER error.

SELECT queries work because the driver's ANSI SQL-92 parser handles simple SELECT parameterization, but INSERT/DML and complex SQL (CTEs, CASE WHEN, etc.) are not reliably handled by the client-side parser.

The fix is to add these two settings to your connection string:

UseNativeQuery=1;EnableNativeParameterizedQuery=1;

For C# OdbcConnection, these must be in the connection string itself, not just the DSN configuration. So your connection string should look something like:

Driver={Databricks};Host=...;Port=443;HTTPPath=...;AuthMech=11;Auth_Flow=0;Auth_AccessToken=...;SSL=1;UseNativeQuery=1;EnableNativeParameterizedQuery=1;

FastSQLPrepare is unrelated to this issue and won't help here.

If you're on an older driver version, I'd also recommend updating to 2.9.1+ as there have been additional fixes for parameterized query handling.

I haven't been able to test this so if it works please mark as accepted solution to help others.

View solution in original post