Skip to content

[BUG] Question marks in comments and string literals interpreted as parameters with supportManyParameters #1331

@glentakahashi

Description

@glentakahashi

Describe the bug
When the supportManyParameters flag is set, question marks in non-parameter locations (comments, string literals, etc.) are incorrectly interpreted as parameters. This section of code literally just finds /any/ occurrence of ? and splits the string. https://github.com/databricks/databricks-jdbc/blob/main/src/main/java/com/databricks/jdbc/common/util/SQLInterpolator.java#L68-L108

To Reproduce
Steps to reproduce the behavior:
Create a prepared statement like:

-- does this work?
select 'hello?', * from mytable where id = ?

Pass in the expected 1 parameter.
Get this error:
Parameter count does not match. Provide equal number of parameters as placeholders.

Expected behavior
Interpolation should properly check only real parameters, not those in comments or literals.

Screenshots
If applicable, add screenshots to help explain your problem.

Client side logs
If available, share redacted client side logs

Client Environment (please complete the following information):

  • OS: [e.g. Windows]: N/A
  • Java version [e.g. Java 21]: N/A
  • Java vendor [e.g. OpenJDK]: N/A
  • Driver Version [e.g. 3.1.1]: 3.2.1
  • BI Tool (if used) [e.g. DBeaver]: N/A
  • BI Tool version (if applicable) [e.g. 24.3.5]: N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions