Skip to content

Support non-prepared queries execution#555

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:execute_direct
Feb 8, 2026
Merged

Support non-prepared queries execution#555
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:execute_direct

Conversation

@staticlibs
Copy link
Collaborator

@staticlibs staticlibs commented Feb 5, 2026

Currently JDBC driver always uses prepare+execute even if the client calls Statement#executeQuery(), not the Connection#prepareStatement() along with PreparedStatement#executeQuery().

This can cause problems (side effects) like the one in #467.

With this PR native prepared statement is only used when Java PreparedStatement is used. Pending query execution logic is used otherwise.

Testing: tests added to cover concurrent closure for prepared and non-prepared statements separately.

Ref: duckdblabs/duckdb-internal#6682

Currently JDBC driver always uses prepare+execute even if the client
calls `Statement#executeQuery()`, not the `Connection#prepareStatement()`
along with `PreparedStatement#executeQuery()`.

This can cause problems (side effects) like the one in duckdb#467.

With this PR native prepared statement is only used when Java
`PreparedStatement` is used. Pending query execution logic is used
otherwise.

Testing: tests added to cover concurrent closure for prepared and
non-prepared statements separately.

Ref: duckdblabs/duckdb-internal#6682
staticlibs added a commit to staticlibs/duckdb-java that referenced this pull request Feb 8, 2026
This is a backport of the PR duckdb#555 to `v1.5-variegata` stable branch.

Currently JDBC driver always uses prepare+execute even if the client
calls `Statement#executeQuery()`, not the `Connection#prepareStatement()`
along with `PreparedStatement#executeQuery()`.

This can cause problems (side effects) like the one in duckdb#467.

With this PR native prepared statement is only used when Java
`PreparedStatement` is used. Pending query execution logic is used
otherwise.

Testing: tests added to cover concurrent closure for prepared and
non-prepared statements separately.

Ref: duckdblabs/duckdb-internal#6682
@staticlibs staticlibs merged commit c8beb97 into duckdb:main Feb 8, 2026
13 checks passed
staticlibs added a commit that referenced this pull request Feb 8, 2026
This is a backport of the PR #555 to `v1.5-variegata` stable branch.

Currently JDBC driver always uses prepare+execute even if the client
calls `Statement#executeQuery()`, not the `Connection#prepareStatement()`
along with `PreparedStatement#executeQuery()`.

This can cause problems (side effects) like the one in #467.

With this PR native prepared statement is only used when Java
`PreparedStatement` is used. Pending query execution logic is used
otherwise.

Testing: tests added to cover concurrent closure for prepared and
non-prepared statements separately.

Ref: duckdblabs/duckdb-internal#6682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant